/**
 *
 */
import Util;
import OpenApi;
import OpenApiUtil;
import EndpointUtil;

extends OpenApi;


init(config: OpenApi.Config){
  super(config);
  @endpointRule = '';
  
  checkConfig(config);
  @endpoint = getEndpoint('paiplugin', @regionId, @endpointRule, @network, @suffix, @endpointMap, @endpoint);
}

function getEndpoint(productId: string, regionId: string, endpointRule: string, network: string, suffix: string, endpointMap: map[string]string, endpoint: string) throws: string{
  if (!Util.empty(endpoint)) {
    return endpoint;
  }
  
  if (!Util.isUnset(endpointMap) && !Util.empty(endpointMap[regionId])) {
    return endpointMap[regionId];
  }
  return EndpointUtil.getEndpointRules(productId, regionId, endpointRule, network, suffix);
}

model CreateCampaignRequest {
  name?: string(name='Name', description='运营活动名称。', example='VIP客户'),
  remark?: string(name='Remark', description='备注。', example='双十一活动'),
}

model CreateCampaignResponseBody = {
  data?: {
    createdTime?: string(name='CreatedTime', description='创建时间 (UTC+8)。', example='2020-01-01 12:00:00'),
    id?: string(name='Id', description='运营活动Id。', example='0a54e195-03e2-40bd-869d-b71cb302783e'),
    name?: string(name='Name', description='运营活动名称。', example='VIP客户'),
    remark?: string(name='Remark', description='备注。', example='双十一活动'),
    updatedTime?: string(name='UpdatedTime', description='更新时间 (UTC+8)。', example='2020-01-01 12:00:00'),
  }(name='Data', description='返回数据。'),
  errorCode?: int32(name='ErrorCode', description='错误码。', example='0'),
  errorMessage?: string(name='ErrorMessage', description='错误信息。', example='OK'),
  requestId?: string(name='RequestId', description='请求ID。', example='f8651828-609d-4de8-ab49-ab781d7fd85a'),
}

model CreateCampaignResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: CreateCampaignResponseBody(name='body'),
}

/**
  * 注册运营活动。
  *
  * @param request CreateCampaignRequest
  * @param headers map
  * @param runtime runtime options for this request RuntimeOptions
  * @return CreateCampaignResponse
 */
async function createCampaignWithOptions(request: CreateCampaignRequest, headers: map[string]string, runtime: Util.RuntimeOptions): CreateCampaignResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.name)) {
    body['Name'] = request.name;
  }
  if (!Util.isUnset(request.remark)) {
    body['Remark'] = request.remark;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'CreateCampaign',
    version = '2022-01-12',
    protocol = 'HTTPS',
    pathname = `/api/v2/campaigns`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
  * 注册运营活动。
  *
  * @param request CreateCampaignRequest
  * @return CreateCampaignResponse
 */
async function createCampaign(request: CreateCampaignRequest): CreateCampaignResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return createCampaignWithOptions(request, headers, runtime);
}

model CreateGroupRequest {
  algorithm?: string(name='Algorithm', description='关联算法，人群来源为算法。', example='user_recall'),
  column?: string(name='Column', description='手机号列名，人群来源为CSV文件，MaxCompute，并且包含手机号时需指定。', example='phone'),
  filter?: string(name='Filter', description='过滤条件，人群来源为MaxCompute时可指定。', example='ds=20220101'),
  inferenceJobId?: string(name='InferenceJobId', description='预测任务Id，人群来源为算法。', example='0a54e195-03e2-40bd-869d-b71cb302783e'),
  name?: string(name='Name', description='人群名称。', example='VIP客户'),
  phoneNumber?: boolean(name='PhoneNumber', description='是否包含手机号，包含手机号的人群可用于触达计划。', example='true'),
  project?: string(name='Project', description='MaxCompute(ODPS)项目名，人群来源为MaxCompute时需指定。', example='project'),
  remark?: string(name='Remark', description='人群备注。', example='充值大于10万'),
  source?: int32(name='Source', description='人群来源。
- 0: 文本，每行一个手机号，最多100个。
- 1: 文本文件，每行一个手机号，可通过控制台上传或指定自定义OSS地址，指定自定义OSS地址前需确保已在控制台完成一键授权。
- 2: CSV文件，需指定手机号列名，可通过控制台上传或指定自定义OSS地址，指定自定义OSS地址前需确保已在控制台完成一键授权。
- 3: MaxCompute(ODPS)表，需指定手机号列名。
- 4: 算法。', example='0'),
  table?: string(name='Table', description='MaxCompute(ODPS)表名，人群来源为MaxCompute时需指定。', example='vip_recall'),
  text?: string(name='Text', description='文本，人群来源为文本时需指定。', example='1390000****'),
  uri?: string(name='Uri', description='文件地址，人群来源为文本文件，CSV文件，MaxCompute时需指定。', example='https://bucket.region.aliyuncs.com/folder/file'),
}

model CreateGroupResponseBody = {
  data?: {
    algorithm?: string(name='Algorithm', description='关联算法，人群来源为算法。', example='user_recall'),
    amount?: int32(name='Amount', description='人群数量。', example='0'),
    column?: string(name='Column', description='手机号列名，人群来源为CSV文件，MaxCompute，并且包含手机号时需指定。', example='phone'),
    createdTime?: string(name='CreatedTime', description='创建时间 (UTC+8)。', example='2020-01-01 12:00:00'),
    filter?: string(name='Filter', description='过滤条件，人群来源为MaxCompute时可指定。', example='ds=20220101'),
    id?: string(name='Id', description='人群Id。', example='0a54e195-03e2-40bd-869d-b71cb302783e'),
    inferenceJobId?: string(name='InferenceJobId', description='预测任务Id，人群来源为算法。', example='0a54e195-03e2-40bd-869d-b71cb302783e'),
    name?: string(name='Name', description='人群名称。', example='VIP客户'),
    phoneNumber?: boolean(name='PhoneNumber', description='是否包含手机号，包含手机号的人群可用于触达计划。', example='1390000****'),
    project?: string(name='Project', description='MaxCompute(ODPS)项目名，人群来源为MaxCompute时需指定。', example='project'),
    remark?: string(name='Remark', description='人群备注。', example='充值大于10万'),
    source?: int32(name='Source', description='人群来源。
- 0: 文本，每行一个手机号，最多100个。
- 1: 文本文件，每行一个手机号，可通过控制台上传或指定自定义OSS地址，指定自定义OSS地址前需确保已在控制台完成一键授权。
- 2: CSV文件，需指定手机号列名，可通过控制台上传或指定自定义OSS地址，指定自定义OSS地址前需确保已在控制台完成一键授权。
- 3: MaxCompute(ODPS)表，需指定手机号列名。
- 4: 算法。', example='0'),
    status?: int32(name='Status', description='人群状态。
- 0: 检查中。
- 1: 已通过。
- 2: 未通过。', example='0'),
    table?: string(name='Table', description='MaxCompute(ODPS)表名，人群来源为MaxCompute时需指定。', example='recall'),
    text?: string(name='Text', description='文本，人群来源为文本时需指定。', example='1390000****'),
    updatedTime?: string(name='UpdatedTime', description='更新时间 (UTC+8)。', example='2020-01-01 12:00:00'),
    uri?: string(name='Uri', description='文件地址，人群来源为文本文件，CSV文件，MaxCompute时需指定。', example='https://bucket.region.aliyuncs.com/folder/file'),
  }(name='Data', description='返回数据。'),
  errorCode?: int32(name='ErrorCode', description='错误码。', example='0'),
  errorMessage?: string(name='ErrorMessage', description='错误信息。', example='OK'),
  requestId?: string(name='RequestId', description='请求ID。', example='f8651828-609d-4de8-ab49-ab781d7fd85a'),
}

model CreateGroupResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: CreateGroupResponseBody(name='body'),
}

/**
  * 注册人群。
  *
  * @param request CreateGroupRequest
  * @param headers map
  * @param runtime runtime options for this request RuntimeOptions
  * @return CreateGroupResponse
 */
async function createGroupWithOptions(request: CreateGroupRequest, headers: map[string]string, runtime: Util.RuntimeOptions): CreateGroupResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.algorithm)) {
    body['Algorithm'] = request.algorithm;
  }
  if (!Util.isUnset(request.column)) {
    body['Column'] = request.column;
  }
  if (!Util.isUnset(request.filter)) {
    body['Filter'] = request.filter;
  }
  if (!Util.isUnset(request.inferenceJobId)) {
    body['InferenceJobId'] = request.inferenceJobId;
  }
  if (!Util.isUnset(request.name)) {
    body['Name'] = request.name;
  }
  if (!Util.isUnset(request.phoneNumber)) {
    body['PhoneNumber'] = request.phoneNumber;
  }
  if (!Util.isUnset(request.project)) {
    body['Project'] = request.project;
  }
  if (!Util.isUnset(request.remark)) {
    body['Remark'] = request.remark;
  }
  if (!Util.isUnset(request.source)) {
    body['Source'] = request.source;
  }
  if (!Util.isUnset(request.table)) {
    body['Table'] = request.table;
  }
  if (!Util.isUnset(request.text)) {
    body['Text'] = request.text;
  }
  if (!Util.isUnset(request.uri)) {
    body['Uri'] = request.uri;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'CreateGroup',
    version = '2022-01-12',
    protocol = 'HTTPS',
    pathname = `/api/v2/groups`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
  * 注册人群。
  *
  * @param request CreateGroupRequest
  * @return CreateGroupResponse
 */
async function createGroup(request: CreateGroupRequest): CreateGroupResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return createGroupWithOptions(request, headers, runtime);
}

model CreateInferenceJobRequest {
  algorithm?: string(name='Algorithm', description='关联算法。', example='user_recall'),
  campaignId?: string(name='CampaignId', description='关联运营活动Id。', example='0a54e195-03e2-40bd-869d-b71cb302783e'),
  dataPath?: string(name='DataPath', description='预测数据路径。', example='https://bucket.region.aliyuncs.com/folder/'),
  name?: string(name='Name', description='预测任务名称。', example='VIP客户'),
  remark?: string(name='Remark', description='备注。', example='充值大于一万'),
  targetPath?: string(name='TargetPath', description='输出数据路径，需要为空目录。', example='https://bucket.region.aliyuncs.com/folder/'),
  trainingJobId?: string(name='TrainingJobId', description='关联训练任务。', example='123'),
  userConfig?: string(name='UserConfig', description='用户配置。', example='{}'),
}

model CreateInferenceJobResponseBody = {
  data?: {
    algorithm?: string(name='Algorithm', description='关联算法。', example='user_recall'),
    campaignId?: string(name='CampaignId', description='关联运营活动Id。', example='0a54e195-03e2-40bd-869d-b71cb302783e'),
    createdTime?: string(name='CreatedTime', description='创建时间 (UTC+8)。', example='2020-01-01 12:00:00'),
    dataPath?: string(name='DataPath', description='预测数据路径。', example='https://bucket.region.aliyuncs.com/folder/'),
    groupId?: string(name='GroupId', description='关联人群Id，如果任务失败则人群无效。', example='bdb0b117-3354-4ceb-ba75-e022dd9370d8'),
    history?: string(name='History', description='预测任务日志。', example='Error: Missing Column.'),
    id?: string(name='Id', description='预测任务Id。', example='0a54e195-03e2-40bd-869d-b71cb302783e'),
    name?: string(name='Name', description='预测任务名称。', example='VIP客户'),
    remark?: string(name='Remark', description='备注。', example='充值大于一万'),
    status?: int32(name='Status', description='预测任务状态。', example='3'),
    targetPath?: string(name='TargetPath', description='输出数据路径，需要为空目录。', example='https://bucket.region.aliyuncs.com/folder/'),
    trainingJobId?: string(name='TrainingJobId', description='关联训练任务。', example='123'),
    updatedTime?: string(name='UpdatedTime', description='更新时间 (UTC+8)。', example='2020-01-01 12:00:00'),
    userConfig?: string(name='UserConfig', description='用户配置。', example='{}'),
  }(name='Data', description='返回数据。'),
  errorCode?: int32(name='ErrorCode', description='错误码。', example='0'),
  errorMessage?: string(name='ErrorMessage', description='错误信息。', example='OK'),
  requestId?: string(name='RequestId', description='请求ID。', example='f8651828-609d-4de8-ab49-ab781d7fd85a'),
}

model CreateInferenceJobResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: CreateInferenceJobResponseBody(name='body'),
}

/**
  * 注册预测任务。
  *
  * @param request CreateInferenceJobRequest
  * @param headers map
  * @param runtime runtime options for this request RuntimeOptions
  * @return CreateInferenceJobResponse
 */
async function createInferenceJobWithOptions(request: CreateInferenceJobRequest, headers: map[string]string, runtime: Util.RuntimeOptions): CreateInferenceJobResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.algorithm)) {
    body['Algorithm'] = request.algorithm;
  }
  if (!Util.isUnset(request.campaignId)) {
    body['CampaignId'] = request.campaignId;
  }
  if (!Util.isUnset(request.dataPath)) {
    body['DataPath'] = request.dataPath;
  }
  if (!Util.isUnset(request.name)) {
    body['Name'] = request.name;
  }
  if (!Util.isUnset(request.remark)) {
    body['Remark'] = request.remark;
  }
  if (!Util.isUnset(request.targetPath)) {
    body['TargetPath'] = request.targetPath;
  }
  if (!Util.isUnset(request.trainingJobId)) {
    body['TrainingJobId'] = request.trainingJobId;
  }
  if (!Util.isUnset(request.userConfig)) {
    body['UserConfig'] = request.userConfig;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'CreateInferenceJob',
    version = '2022-01-12',
    protocol = 'HTTPS',
    pathname = `/api/v2/inference/jobs`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
  * 注册预测任务。
  *
  * @param request CreateInferenceJobRequest
  * @return CreateInferenceJobResponse
 */
async function createInferenceJob(request: CreateInferenceJobRequest): CreateInferenceJobResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return createInferenceJobWithOptions(request, headers, runtime);
}

model CreateScheduleRequest {
  AISendEndDate?: string(name='AISendEndDate', example='2022-02-01 12:00:00'),
  AISendStartDate?: string(name='AISendStartDate', example='2022-01-01 12:00:00'),
  endTime?: int32(name='EndTime', description='终止时间（UTC+8）。', example='2020-01-01'),
  executeTime?: string(name='ExecuteTime', description='执行时间 (UTC+8)，为空立即执行。', example='2020-01-01 12:00:00'),
  groupId?: string(name='GroupId', description='人群ID。', example='0a54e195-03e2-40bd-869d-b71cb302783e'),
  name?: string(name='Name', description='触达计划名称。', example='增长-2021-0101'),
  paymentType?: string(name='PaymentType', example='PayAsYougo'),
  repeatCycle?: int32(name='RepeatCycle', description='重复周期，按重复周期与重复周期单位执行。', example='0'),
  repeatCycleUnit?: int32(name='RepeatCycleUnit', description='重复周期单位，若指定执行时间，则重复周期生效。
- 0: 从不（默认）。
- 1: 小时。
- 2: 天。
- 3: 周。
- 4: 月。', example='0'),
  repeatTimes?: int32(name='RepeatTimes', description='重复次数。
- 0: 不设终止时间（默认）。
- N: 重复N次后终止。', example='1'),
  signName?: string(name='SignName', description='签名。', example='PAI'),
  signatureId?: string(name='SignatureId', description='签名ID，或指定签名。', example='0a54e195-03e2-40bd-869d-b71cb302783e'),
  templateCode?: string(name='TemplateCode', description='模板Code。', example='SMS_123456'),
  templateId?: string(name='TemplateId', description='模板ID，或指定模板Code。', example='0a54e195-03e2-40bd-869d-b71cb302783e'),
}

model CreateScheduleResponseBody = {
  data?: {
    createdTime?: string(name='CreatedTime', description='创建时间 (UTC+8)。', example='2020-01-01 12:00:00'),
    endTime?: int32(name='EndTime', description='终止时间（UTC+8）。', example='2020-01-01'),
    executeTime?: string(name='ExecuteTime', description='执行时间 (UTC+8)，为空立即执行。', example='2020-01-01 12:00:00'),
    groupId?: string(name='GroupId', description='人群ID。', example='0a54e195-03e2-40bd-869d-b71cb302783e'),
    id?: string(name='Id', description='触达计划ID。', example='0a54e195-03e2-40bd-869d-b71cb302783e'),
    name?: string(name='Name', description='触达计划名称。', example='增长-2021-0101'),
    repeatCycle?: int32(name='RepeatCycle', description='重复周期，按重复周期与重复周期单位执行。', example='0'),
    repeatCycleUnit?: int32(name='RepeatCycleUnit', description='重复周期单位，若指定执行时间，则重复周期生效。
- 0: 从不（默认）。
- 1: 小时。
- 2: 天。
- 3: 周。
- 4: 月。', example='0'),
    repeatTimes?: int32(name='RepeatTimes', description='重复次数。
- 0: 不设终止时间（默认）。
- N: 重复N次后终止。', example='1'),
    signName?: string(name='SignName', description='签名。', example='PAI'),
    signatureId?: string(name='SignatureId', description='签名ID，或指定签名。', example='0a54e195-03e2-40bd-869d-b71cb302783e'),
    status?: int32(name='Status', description='状态。
- 0: 检查中。
- 1: 检查成功。
- 2: 检查失败。
- 3: 发送中。
- 4: 发送成功。
- 5: 发送失败。', example='0'),
    templateCode?: string(name='TemplateCode', description='模板Code。', example='SMS_123456'),
    templateId?: string(name='TemplateId', description='模板ID，或指定模板Code。', example='0a54e195-03e2-40bd-869d-b71cb302783e'),
    updatedTime?: string(name='UpdatedTime', description='更新时间 (UTC+8)。', example='2020-01-01 12:00:00'),
  }(name='Data', description='返回数据。'),
  errorCode?: int32(name='ErrorCode', description='错误码。', example='0'),
  errorMessage?: string(name='ErrorMessage', description='错误信息。', example='OK'),
  requestId?: string(name='RequestId', description='请求ID。', example='f8651828-609d-4de8-ab49-ab781d7fd85a'),
}

model CreateScheduleResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: CreateScheduleResponseBody(name='body'),
}

async function createScheduleWithOptions(request: CreateScheduleRequest, headers: map[string]string, runtime: Util.RuntimeOptions): CreateScheduleResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.AISendEndDate)) {
    body['AISendEndDate'] = request.AISendEndDate;
  }
  if (!Util.isUnset(request.AISendStartDate)) {
    body['AISendStartDate'] = request.AISendStartDate;
  }
  if (!Util.isUnset(request.endTime)) {
    body['EndTime'] = request.endTime;
  }
  if (!Util.isUnset(request.executeTime)) {
    body['ExecuteTime'] = request.executeTime;
  }
  if (!Util.isUnset(request.groupId)) {
    body['GroupId'] = request.groupId;
  }
  if (!Util.isUnset(request.name)) {
    body['Name'] = request.name;
  }
  if (!Util.isUnset(request.paymentType)) {
    body['PaymentType'] = request.paymentType;
  }
  if (!Util.isUnset(request.repeatCycle)) {
    body['RepeatCycle'] = request.repeatCycle;
  }
  if (!Util.isUnset(request.repeatCycleUnit)) {
    body['RepeatCycleUnit'] = request.repeatCycleUnit;
  }
  if (!Util.isUnset(request.repeatTimes)) {
    body['RepeatTimes'] = request.repeatTimes;
  }
  if (!Util.isUnset(request.signName)) {
    body['SignName'] = request.signName;
  }
  if (!Util.isUnset(request.signatureId)) {
    body['SignatureId'] = request.signatureId;
  }
  if (!Util.isUnset(request.templateCode)) {
    body['TemplateCode'] = request.templateCode;
  }
  if (!Util.isUnset(request.templateId)) {
    body['TemplateId'] = request.templateId;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'CreateSchedule',
    version = '2022-01-12',
    protocol = 'HTTPS',
    pathname = `/api/v2/schedules`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function createSchedule(request: CreateScheduleRequest): CreateScheduleResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return createScheduleWithOptions(request, headers, runtime);
}

model CreateSignatureRequest {
  description?: string(name='Description', description='申请说明。', example='申请说明'),
  name?: string(name='Name', description='签名名称。', example='用户增长'),
}

model CreateSignatureResponseBody = {
  data?: {
    createdTime?: string(name='CreatedTime', description='创建时间 (UTC+8)。', example='2020-01-01 12:00:00'),
    id?: string(name='Id', description='签名ID。', example='0a54e195-03e2-40bd-869d-b71cb302783e'),
    name?: string(name='Name', description='签名名称。', example='用户增长'),
    status?: int32(name='Status', description='签名审核状态。
- 0：审核中。
- 1：审核通过。
- 2：审核不通过。', example='0'),
    updatedTime?: string(name='UpdatedTime', description='更新时间 (UTC+8)。', example='2020-01-01 12:00:00'),
  }(name='Data', description='返回数据。'),
  errorCode?: int32(name='ErrorCode', description='错误码。', example='0'),
  errorMessage?: string(name='ErrorMessage', description='错误信息。', example='OK'),
  requestId?: string(name='RequestId', description='请求ID。', example='0'),
}

model CreateSignatureResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: CreateSignatureResponseBody(name='body'),
}

async function createSignatureWithOptions(request: CreateSignatureRequest, headers: map[string]string, runtime: Util.RuntimeOptions): CreateSignatureResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.description)) {
    body['Description'] = request.description;
  }
  if (!Util.isUnset(request.name)) {
    body['Name'] = request.name;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'CreateSignature',
    version = '2022-01-12',
    protocol = 'HTTPS',
    pathname = `/api/v2/signatures`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function createSignature(request: CreateSignatureRequest): CreateSignatureResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return createSignatureWithOptions(request, headers, runtime);
}

model CreateTemplateRequest {
  content?: string(name='Content', description='模板内容，请注意控制总字数在70个字以内，超出部分按长短信收费，按67个字为单位记一条短信，营销短信必须在结尾添加“回T退订”。', example='模板内容'),
  description?: string(name='Description', description='申请说明。', example='申请说明'),
  name?: string(name='Name', description='模板名称。', example='模板召回-20220101'),
  signature?: string(name='Signature', description='签名名称，同时只能指定签名名称或签名ID其中之一。', example='PAI'),
  signatureId?: string(name='SignatureId', description='签名ID，可通过ListSignatures获取审核状态为已通过的签名列表，获取签名ID。', example='5480e3e7-f578-42d2-8ce8-217dec75f2e6'),
  type?: int32(name='Type', description='模板类型。
- 0 : 验证码。
- 1 : 短信通知。
- 2 : 推广短信。', example='2'),
}

model CreateTemplateResponseBody = {
  data?: {
    content?: string(name='Content', description='模板内容。', example='心仪的TA刚刚给你留言了'),
    createdTime?: string(name='CreatedTime', description='创建时间 (UTC+8)。', example='2020-01-01 12:00:00'),
    description?: string(name='Description', description='申请说明。', example='申请说明'),
    id?: string(name='Id', description='模板ID。', example='0a54e195-03e2-40bd-869d-b71cb302783e'),
    name?: string(name='Name', description='模板名称。', example='模板召回-20220101'),
    reason?: string(name='Reason', description='审核意见。', example='同意'),
    signature?: string(name='Signature', description='签名。', example='PAI通知'),
    signatureId?: string(name='SignatureId', description='签名ID。', example='5480e3e7-f578-42d2-8ce8-217dec75f2e6'),
    status?: int32(name='Status', description='审核状态。
- 0 : 审核中。
- 1 : 审核通过。
- 2 : 审核不通过。', example='0'),
    templateCode?: string(name='TemplateCode', description='模板Code。', example='SMS_123456'),
    type?: int32(name='Type', description='模板类型。
- 0 : 验证码。
- 1 : 短信通知。
- 2 : 推广短信。', example='1'),
    updatedTime?: string(name='UpdatedTime', description='更新时间 (UTC+8)。', example='2020-01-01 12:00:00'),
  }(name='Data', description='返回数据。'),
  errorCode?: int32(name='ErrorCode', description='错误码。', example='0'),
  errorMessage?: string(name='ErrorMessage', description='错误信息。', example='OK'),
  requestId?: string(name='RequestId', description='请求ID。', example='f8651828-609d-4de8-ab49-ab781d7fd85a'),
}

model CreateTemplateResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: CreateTemplateResponseBody(name='body'),
}

async function createTemplateWithOptions(request: CreateTemplateRequest, headers: map[string]string, runtime: Util.RuntimeOptions): CreateTemplateResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.content)) {
    body['Content'] = request.content;
  }
  if (!Util.isUnset(request.description)) {
    body['Description'] = request.description;
  }
  if (!Util.isUnset(request.name)) {
    body['Name'] = request.name;
  }
  if (!Util.isUnset(request.signature)) {
    body['Signature'] = request.signature;
  }
  if (!Util.isUnset(request.signatureId)) {
    body['SignatureId'] = request.signatureId;
  }
  if (!Util.isUnset(request.type)) {
    body['Type'] = request.type;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'CreateTemplate',
    version = '2022-01-12',
    protocol = 'HTTPS',
    pathname = `/api/v2/templates`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function createTemplate(request: CreateTemplateRequest): CreateTemplateResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return createTemplateWithOptions(request, headers, runtime);
}

model CreateTrainingJobRequest {
  algorithm?: string(name='Algorithm', description='关联算法ID。', example='user_recall'),
  campaignId?: string(name='CampaignId', description='关联运营活动ID。', example='0a54e195-03e2-40bd-869d-b71cb302783e'),
  dataPath?: string(name='DataPath', description='训练数据路径，指定路径前需确保已在控制台完成一键授权。', example='https://bucket.region.aliyuncs.com/folder/'),
  name?: string(name='Name', description='训练任务名称。', example='VIP客户'),
  remark?: string(name='Remark', description='备注。', example='充值大于一万'),
  userConfig?: string(name='UserConfig', description='用户配置。', example='{"start_date": "20210101", "end_date": "20210131"}'),
}

model CreateTrainingJobResponseBody = {
  data?: {
    algorithm?: string(name='Algorithm', description='关联算法ID。', example='user_recall'),
    campaignId?: string(name='CampaignId', description='关联运营活动ID。', example='0a54e195-03e2-40bd-869d-b71cb302783e'),
    createdTime?: string(name='CreatedTime', description='创建时间 (UTC+8)。', example='2020-01-01 12:00:00'),
    dataPath?: string(name='DataPath', description='训练数据路径，指定路径前需确保已在控制台完成一键授权。', example='https://bucket.region.aliyuncs.com/folder/'),
    hasModelInfo?: boolean(name='HasModelInfo', example='false'),
    history?: string(name='History', description='训练任务日志。', example='Error: Parameter are not found.'),
    id?: string(name='Id', description='训练任务ID。', example='0a54e195-03e2-40bd-869d-b71cb302783e'),
    name?: string(name='Name', description='训练任务名称。', example='VIP客户'),
    remark?: string(name='Remark', description='备注。', example='充值大于一万'),
    status?: int32(name='Status', description='训练任务状态。
- 0: 队列中。
- 1: 已提交。
- 2: 运行中。
- 3: 成功。
- 4: 失败。', example='3'),
    trainingScheduleId?: string(name='TrainingScheduleId', description='关联训练计划ID。', example='0a54e195-03e2-40bd-869d-b71cb302783e'),
    updatedTime?: string(name='UpdatedTime', description='更新时间 (UTC+8)。', example='2020-01-01 12:00:00'),
    userConfig?: string(name='UserConfig', description='用户配置。', example='{}'),
  }(name='Data', description='返回数据。'),
  errorCode?: int32(name='ErrorCode', description='错误码。', example='0'),
  errorMessage?: string(name='ErrorMessage', description='错误信息。', example='OK'),
  requestId?: string(name='RequestId', description='请求ID。', example='f8651828-609d-4de8-ab49-ab781d7fd85a'),
}

model CreateTrainingJobResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: CreateTrainingJobResponseBody(name='body'),
}

async function createTrainingJobWithOptions(request: CreateTrainingJobRequest, headers: map[string]string, runtime: Util.RuntimeOptions): CreateTrainingJobResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.algorithm)) {
    body['Algorithm'] = request.algorithm;
  }
  if (!Util.isUnset(request.campaignId)) {
    body['CampaignId'] = request.campaignId;
  }
  if (!Util.isUnset(request.dataPath)) {
    body['DataPath'] = request.dataPath;
  }
  if (!Util.isUnset(request.name)) {
    body['Name'] = request.name;
  }
  if (!Util.isUnset(request.remark)) {
    body['Remark'] = request.remark;
  }
  if (!Util.isUnset(request.userConfig)) {
    body['UserConfig'] = request.userConfig;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'CreateTrainingJob',
    version = '2022-01-12',
    protocol = 'HTTPS',
    pathname = `/api/v2/training/jobs`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function createTrainingJob(request: CreateTrainingJobRequest): CreateTrainingJobResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return createTrainingJobWithOptions(request, headers, runtime);
}

model DeleteCampaignResponseBody = {
  data?: string(name='Data', description='返回数据。', example='OK'),
  errorCode?: int32(name='ErrorCode', description='错误码。', example='0'),
  errorMessage?: string(name='ErrorMessage', description='错误信息。', example='OK'),
  requestId?: string(name='RequestId', description='请求ID。', example='f8651828-609d-4de8-ab49-ab781d7fd85a'),
}

model DeleteCampaignResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: DeleteCampaignResponseBody(name='body'),
}

/**
  * 删除运营活动
  *
  * @param headers map
  * @param runtime runtime options for this request RuntimeOptions
  * @return DeleteCampaignResponse
 */
async function deleteCampaignWithOptions(Id: string, headers: map[string]string, runtime: Util.RuntimeOptions): DeleteCampaignResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'DeleteCampaign',
    version = '2022-01-12',
    protocol = 'HTTPS',
    pathname = `/api/v2/campaigns/${OpenApiUtil.getEncodeParam(Id)}`,
    method = 'DELETE',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
  * 删除运营活动
  *
  * @return DeleteCampaignResponse
 */
async function deleteCampaign(Id: string): DeleteCampaignResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return deleteCampaignWithOptions(Id, headers, runtime);
}

model DeleteGroupResponseBody = {
  data?: string(name='Data', description='返回数据。', example='OK'),
  errorCode?: int32(name='ErrorCode', description='错误码。', example='0'),
  errorMessage?: string(name='ErrorMessage', description='错误信息。', example='OK'),
  requestId?: string(name='RequestId', description='请求ID。', example='f8651828-609d-4de8-ab49-ab781d7fd85a'),
}

model DeleteGroupResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: DeleteGroupResponseBody(name='body'),
}

/**
  * 删除人群
  *
  * @param headers map
  * @param runtime runtime options for this request RuntimeOptions
  * @return DeleteGroupResponse
 */
async function deleteGroupWithOptions(Id: string, headers: map[string]string, runtime: Util.RuntimeOptions): DeleteGroupResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'DeleteGroup',
    version = '2022-01-12',
    protocol = 'HTTPS',
    pathname = `/api/v2/groups/${OpenApiUtil.getEncodeParam(Id)}`,
    method = 'DELETE',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
  * 删除人群
  *
  * @return DeleteGroupResponse
 */
async function deleteGroup(Id: string): DeleteGroupResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return deleteGroupWithOptions(Id, headers, runtime);
}

model DeleteInferenceJobResponseBody = {
  data?: string(name='Data', description='返回数据。', example='OK'),
  errorCode?: int32(name='ErrorCode', description='错误码。', example='0'),
  errorMessage?: string(name='ErrorMessage', description='错误信息。', example='OK'),
  requestId?: string(name='RequestId', description='请求ID。', example='f8651828-609d-4de8-ab49-ab781d7fd85a'),
}

model DeleteInferenceJobResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: DeleteInferenceJobResponseBody(name='body'),
}

/**
  * 删除预测任务。
  *
  * @param headers map
  * @param runtime runtime options for this request RuntimeOptions
  * @return DeleteInferenceJobResponse
 */
async function deleteInferenceJobWithOptions(Id: string, headers: map[string]string, runtime: Util.RuntimeOptions): DeleteInferenceJobResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'DeleteInferenceJob',
    version = '2022-01-12',
    protocol = 'HTTPS',
    pathname = `/api/v2/inference/jobs/${OpenApiUtil.getEncodeParam(Id)}`,
    method = 'DELETE',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
  * 删除预测任务。
  *
  * @return DeleteInferenceJobResponse
 */
async function deleteInferenceJob(Id: string): DeleteInferenceJobResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return deleteInferenceJobWithOptions(Id, headers, runtime);
}

model DeleteScheduleResponseBody = {
  data?: string(name='Data', description='返回数据。', example='OK'),
  errorCode?: int32(name='ErrorCode', description='错误码。', example='0'),
  errorMessage?: string(name='ErrorMessage', description='错误信息。', example='OK'),
  requestId?: string(name='RequestId', description='请求ID。', example='f8651828-609d-4de8-ab49-ab781d7fd85a'),
}

model DeleteScheduleResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: DeleteScheduleResponseBody(name='body'),
}

/**
  * 删除触达计划。
  *
  * @param headers map
  * @param runtime runtime options for this request RuntimeOptions
  * @return DeleteScheduleResponse
 */
async function deleteScheduleWithOptions(Id: string, headers: map[string]string, runtime: Util.RuntimeOptions): DeleteScheduleResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'DeleteSchedule',
    version = '2022-01-12',
    protocol = 'HTTPS',
    pathname = `/api/v2/schedules/${OpenApiUtil.getEncodeParam(Id)}`,
    method = 'DELETE',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
  * 删除触达计划。
  *
  * @return DeleteScheduleResponse
 */
async function deleteSchedule(Id: string): DeleteScheduleResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return deleteScheduleWithOptions(Id, headers, runtime);
}

model DeleteSignatureResponseBody = {
  data?: string(name='Data', description='返回数据。', example='OK'),
  errorCode?: int32(name='ErrorCode', description='错误码。', example='0'),
  errorMessage?: string(name='ErrorMessage', description='错误信息。', example='OK'),
  requestId?: string(name='RequestId', description='请求ID。', example='f8651828-609d-4de8-ab49-ab781d7fd85a'),
}

model DeleteSignatureResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: DeleteSignatureResponseBody(name='body'),
}

async function deleteSignatureWithOptions(Id: string, headers: map[string]string, runtime: Util.RuntimeOptions): DeleteSignatureResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'DeleteSignature',
    version = '2022-01-12',
    protocol = 'HTTPS',
    pathname = `/api/v2/signatures/${OpenApiUtil.getEncodeParam(Id)}`,
    method = 'DELETE',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function deleteSignature(Id: string): DeleteSignatureResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return deleteSignatureWithOptions(Id, headers, runtime);
}

model DeleteTemplateResponseBody = {
  data?: string(name='Data', description='返回数据。', example='OK'),
  errorCode?: int32(name='ErrorCode', description='错误码。', example='0'),
  errorMessage?: string(name='ErrorMessage', description='错误信息。', example='OK'),
  requestId?: string(name='RequestId', description='请求ID。', example='f8651828-609d-4de8-ab49-ab781d7fd85a'),
}

model DeleteTemplateResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: DeleteTemplateResponseBody(name='body'),
}

/**
  * 删除模板
  *
  * @param headers map
  * @param runtime runtime options for this request RuntimeOptions
  * @return DeleteTemplateResponse
 */
async function deleteTemplateWithOptions(Id: string, headers: map[string]string, runtime: Util.RuntimeOptions): DeleteTemplateResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'DeleteTemplate',
    version = '2022-01-12',
    protocol = 'HTTPS',
    pathname = `/api/v2/templates/${OpenApiUtil.getEncodeParam(Id)}`,
    method = 'DELETE',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
  * 删除模板
  *
  * @return DeleteTemplateResponse
 */
async function deleteTemplate(Id: string): DeleteTemplateResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return deleteTemplateWithOptions(Id, headers, runtime);
}

model DeleteTrainingJobResponseBody = {
  data?: string(name='Data', description='返回数据。', example='OK'),
  errorCode?: int32(name='ErrorCode', description='错误码。', example='0'),
  errorMessage?: string(name='ErrorMessage', description='错误信息。', example='OK'),
  requestId?: string(name='RequestId', description='请求ID。', example='f8651828-609d-4de8-ab49-ab781d7fd85a'),
}

model DeleteTrainingJobResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: DeleteTrainingJobResponseBody(name='body'),
}

/**
  * 删除训练任务。
  *
  * @param headers map
  * @param runtime runtime options for this request RuntimeOptions
  * @return DeleteTrainingJobResponse
 */
async function deleteTrainingJobWithOptions(Id: string, headers: map[string]string, runtime: Util.RuntimeOptions): DeleteTrainingJobResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'DeleteTrainingJob',
    version = '2022-01-12',
    protocol = 'HTTPS',
    pathname = `/api/v2/training/jobs/${OpenApiUtil.getEncodeParam(Id)}`,
    method = 'DELETE',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
  * 删除训练任务。
  *
  * @return DeleteTrainingJobResponse
 */
async function deleteTrainingJob(Id: string): DeleteTrainingJobResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return deleteTrainingJobWithOptions(Id, headers, runtime);
}

model GetAlgorithmResponseBody = {
  data?: {
    description?: string(name='Description', description='算法说明。', example='算法说明'),
    id?: string(name='Id', description='算法Id。', example='sms_recall'),
    inferUserConfigMap?: string(name='InferUserConfigMap', description='预测所需参数名与对应的参数说明。', example='{}'),
    name?: string(name='Name', description='算法名称。', example='短信召回'),
    trainUserConfigMap?: string(name='TrainUserConfigMap', description='训练所需参数名与对应的参数说明。', example='{}'),
  }(name='Data', description='返回数据。'),
  errorCode?: int32(name='ErrorCode', description='错误码。', example='0'),
  errorMessage?: string(name='ErrorMessage', description='错误信息。', example='OK'),
  requestId?: string(name='RequestId', description='请求ID。', example='f8651828-609d-4de8-ab49-ab781d7fd85a'),
}

model GetAlgorithmResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: GetAlgorithmResponseBody(name='body'),
}

/**
  * 获取算法详情。
  *
  * @param headers map
  * @param runtime runtime options for this request RuntimeOptions
  * @return GetAlgorithmResponse
 */
async function getAlgorithmWithOptions(Id: string, headers: map[string]string, runtime: Util.RuntimeOptions): GetAlgorithmResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'GetAlgorithm',
    version = '2022-01-12',
    protocol = 'HTTPS',
    pathname = `/api/v2/algorithms/${OpenApiUtil.getEncodeParam(Id)}`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
  * 获取算法详情。
  *
  * @return GetAlgorithmResponse
 */
async function getAlgorithm(Id: string): GetAlgorithmResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return getAlgorithmWithOptions(Id, headers, runtime);
}

model GetCampaignResponseBody = {
  data?: {
    createdTime?: string(name='CreatedTime', description='创建时间 (UTC+8)。', example='2020-01-01 12:00:00'),
    id?: string(name='Id', description='运营活动Id。', example='0a54e195-03e2-40bd-869d-b71cb302783e'),
    name?: string(name='Name', description='运营活动名称。', example='VIP客户'),
    remark?: string(name='Remark', description='备注。', example='双十一活动'),
    updatedTime?: string(name='UpdatedTime', description='更新时间 (UTC+8)。', example='2020-01-01 12:00:00'),
  }(name='Data', description='返回数据。'),
  errorCode?: int32(name='ErrorCode', description='错误码。', example='0'),
  errorMessage?: string(name='ErrorMessage', description='错误信息。', example='OK'),
  requestId?: string(name='RequestId', description='请求ID。', example='f8651828-609d-4de8-ab49-ab781d7fd85a'),
}

model GetCampaignResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: GetCampaignResponseBody(name='body'),
}

/**
  * 获取运营活动详情。
  *
  * @param headers map
  * @param runtime runtime options for this request RuntimeOptions
  * @return GetCampaignResponse
 */
async function getCampaignWithOptions(Id: string, headers: map[string]string, runtime: Util.RuntimeOptions): GetCampaignResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'GetCampaign',
    version = '2022-01-12',
    protocol = 'HTTPS',
    pathname = `/api/v2/campaigns/${OpenApiUtil.getEncodeParam(Id)}`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
  * 获取运营活动详情。
  *
  * @return GetCampaignResponse
 */
async function getCampaign(Id: string): GetCampaignResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return getCampaignWithOptions(Id, headers, runtime);
}

model GetGroupResponseBody = {
  data?: {
    algorithm?: string(name='Algorithm', description='关联算法，人群来源为算法。', example='user_recall'),
    amount?: int32(name='Amount', description='人群数量。', example='0'),
    campaignId?: string(name='CampaignId', description='关联运营活动Id。', example='0a54e195-03e2-40bd-869d-b71cb302783e'),
    column?: string(name='Column', description='手机号列名，人群来源为CSV文件，MaxCompute，并且包含手机号时需指定。', example='education'),
    createdTime?: string(name='CreatedTime', description='创建时间 (UTC+8)。', example='2020-01-01 12:00:00'),
    filter?: string(name='Filter', description='过滤条件，人群来源为MaxCompute时可指定。', example='ds=2022'),
    history?: string(name='History', description='历史记录。', example='Project not found - \\"sms_test\\"'),
    id?: string(name='Id', description='人群Id。', example='0a54e195-03e2-40bd-869d-b71cb302783e'),
    inferenceJobId?: string(name='InferenceJobId', description='预测任务Id，人群来源为算法。', example='0a54e195-03e2-40bd-869d-b71cb302783e'),
    name?: string(name='Name', description='人群名称。', example='VIP客户'),
    phoneNumber?: boolean(name='PhoneNumber', description='是否包含手机号，包含手机号的人群可用于触达计划。', example='true'),
    project?: string(name='Project', description='MaxCompute(ODPS)项目名，人群来源为MaxCompute时需指定。', example='project'),
    remark?: string(name='Remark', description='人群备注。', example='充值大于10万'),
    source?: int32(name='Source', description='人群来源。
- 0: 文本，每行一个手机号，最多100个。
- 1: 文本文件，每行一个手机号，可通过控制台上传或指定自定义OSS地址，指定自定义OSS地址前需确保已在控制台完成一键授权。
- 2: 多列CSV文件，需指定手机号列名，可通过控制台上传或指定自定义OSS地址，指定自定义OSS地址前需确保已在控制台完成一键授权。
- 3: MaxCompute表，需指定手机号列名。
- 4: 算法。', example='0'),
    status?: int32(name='Status', description='人群状态。
- 0: 检查中。
- 1: 已通过。
- 2: 未通过。', example='0'),
    table?: string(name='Table', description='MaxCompute(ODPS)表名，人群来源为MaxCompute时需指定。', example='recall'),
    text?: string(name='Text', description='文本，人群来源为文本时需指定。', example='1390000****'),
    updatedTime?: string(name='UpdatedTime', description='更新时间 (UTC+8)。', example='2020-01-01 12:00:00'),
    uri?: string(name='Uri', description='文件地址，人群来源为文本文件，CSV文件时需指定。', example='https://bucket.region.aliyuncs.com/folder/file'),
  }(name='Data', description='返回数据。'),
  errorCode?: int32(name='ErrorCode', description='错误码。', example='0'),
  errorMessage?: string(name='ErrorMessage', description='错误信息。', example='OK'),
  requestId?: string(name='RequestId', description='请求ID。', example='f8651828-609d-4de8-ab49-ab781d7fd85a'),
}

model GetGroupResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: GetGroupResponseBody(name='body'),
}

/**
  * 获取人群详情。
  *
  * @param headers map
  * @param runtime runtime options for this request RuntimeOptions
  * @return GetGroupResponse
 */
async function getGroupWithOptions(Id: string, headers: map[string]string, runtime: Util.RuntimeOptions): GetGroupResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'GetGroup',
    version = '2022-01-12',
    protocol = 'HTTPS',
    pathname = `/api/v2/groups/${OpenApiUtil.getEncodeParam(Id)}`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
  * 获取人群详情。
  *
  * @return GetGroupResponse
 */
async function getGroup(Id: string): GetGroupResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return getGroupWithOptions(Id, headers, runtime);
}

model GetInferenceJobResponseBody = {
  data?: {
    algorithm?: string(name='Algorithm', description='关联算法。', example='user_recall'),
    campaignId?: string(name='CampaignId', description='关联运营活动Id。', example='0a54e195-03e2-40bd-869d-b71cb302783e'),
    createdTime?: string(name='CreatedTime', description='创建时间 (UTC+8)。', example='2020-01-01 12:00:00'),
    dataPath?: string(name='DataPath', description='预测数据路径。', example='https://bucket.region.aliyuncs.com/folder/'),
    groupId?: string(name='GroupId', description='关联人群Id，如果任务失败则人群无效。', example='0197261b-30e6-467b-83d6-7f72af868b03'),
    history?: string(name='History', description='预测任务日志。', example='Error: Missing Column.'),
    id?: string(name='Id', description='预测任务Id。', example='0a54e195-03e2-40bd-869d-b71cb302783e'),
    name?: string(name='Name', description='预测任务名称。', example='VIP客户'),
    remark?: string(name='Remark', description='备注。', example='充值大于一万'),
    status?: int32(name='Status', description='预测任务状态。', example='3'),
    targetPath?: string(name='TargetPath', description='输出数据路径，需要为空目录。', example='https://bucket.region.aliyuncs.com/folder/'),
    trainingJobId?: string(name='TrainingJobId', description='关联训练任务。', example='123'),
    updatedTime?: string(name='UpdatedTime', description='更新时间 (UTC+8)。', example='2020-01-01 12:00:00'),
    userConfig?: string(name='UserConfig', description='用户配置。', example='{}'),
  }(name='Data', description='返回数据。'),
  errorCode?: int32(name='ErrorCode', description='错误码。', example='0'),
  errorMessage?: string(name='ErrorMessage', description='错误信息。', example='OK'),
  requestId?: string(name='RequestId', description='请求ID。', example='f8651828-609d-4de8-ab49-ab781d7fd85a'),
}

model GetInferenceJobResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: GetInferenceJobResponseBody(name='body'),
}

/**
  * 获取预测任务详情。
  *
  * @param headers map
  * @param runtime runtime options for this request RuntimeOptions
  * @return GetInferenceJobResponse
 */
async function getInferenceJobWithOptions(Id: string, headers: map[string]string, runtime: Util.RuntimeOptions): GetInferenceJobResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'GetInferenceJob',
    version = '2022-01-12',
    protocol = 'HTTPS',
    pathname = `/api/v2/inference/jobs/${OpenApiUtil.getEncodeParam(Id)}`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
  * 获取预测任务详情。
  *
  * @return GetInferenceJobResponse
 */
async function getInferenceJob(Id: string): GetInferenceJobResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return getInferenceJobWithOptions(Id, headers, runtime);
}

model GetMessageConfigResponseBody = {
  data?: {
    smsReportUrl?: string(name='SmsReportUrl', description='短信发送状态回执接收服务地址。', example='http://example.com'),
    smsUpUrl?: string(name='SmsUpUrl', description='上行短信消息接收服务地址。', example='http://example.com'),
  }(name='Data', description='返回数据。'),
  errorCode?: int32(name='ErrorCode', description='错误码。', example='0'),
  errorMessage?: string(name='ErrorMessage', description='错误信息。', example='OK'),
  requestId?: string(name='RequestId', description='请求ID。', example='f8651828-609d-4de8-ab49-ab781d7fd85a'),
}

model GetMessageConfigResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: GetMessageConfigResponseBody(name='body'),
}

/**
  * 获取短信配置。
  *
  * @param headers map
  * @param runtime runtime options for this request RuntimeOptions
  * @return GetMessageConfigResponse
 */
async function getMessageConfigWithOptions(headers: map[string]string, runtime: Util.RuntimeOptions): GetMessageConfigResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'GetMessageConfig',
    version = '2022-01-12',
    protocol = 'HTTPS',
    pathname = `/api/v2/users/messageConfig`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
  * 获取短信配置。
  *
  * @return GetMessageConfigResponse
 */
async function getMessageConfig(): GetMessageConfigResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return getMessageConfigWithOptions(headers, runtime);
}

model GetScheduleResponseBody = {
  data?: {
    createdTime?: string(name='CreatedTime', description='创建时间 (UTC+8)。', example='2020-01-01 12:00:00'),
    endTime?: int32(name='EndTime', description='终止时间（UTC+8）。', example='2020-01-01'),
    executeTime?: string(name='ExecuteTime', description='执行时间 (UTC+8)，为空立即执行。', example='2020-01-01 12:00:00'),
    groupId?: string(name='GroupId', description='人群ID。', example='0a54e195-03e2-40bd-869d-b71cb302783e'),
    history?: string(name='History', description='历史记录。', example='string'),
    id?: string(name='Id', description='触达计划ID。', example='0a54e195-03e2-40bd-869d-b71cb302783e'),
    name?: string(name='Name', description='触达计划名称。', example='增长-2021-0101'),
    paymentType?: string(name='PaymentType', example='Subscription'),
    repeatCycle?: int32(name='RepeatCycle', description='重复周期，按重复周期与重复周期单位执行。', example='0'),
    repeatCycleUnit?: int32(name='RepeatCycleUnit', description='重复周期单位，若指定执行时间，则重复周期生效。
- 0: 从不（默认）。
- 1: 小时。
- 2: 天。
- 3: 周。
- 4: 月。', example='0'),
    repeatTimes?: int32(name='RepeatTimes', description='重复次数。
- 0: 不设终止时间（默认）。
- N: 重复N次后终止。', example='1'),
    signName?: string(name='SignName', description='签名。', example='PAI'),
    signatureId?: string(name='SignatureId', description='签名ID，或指定签名。', example='0a54e195-03e2-40bd-869d-b71cb302783e'),
    status?: int32(name='Status', description='状态。
- 0: 检查中。
- 1: 检查成功。
- 2: 检查失败。
- 3: 发送中。
- 4: 发送成功。
- 5: 发送失败。', example='0'),
    templateCode?: string(name='TemplateCode', description='模板Code。', example='SMS_123456'),
    templateId?: string(name='TemplateId', description='模板ID，或指定模板Code。', example='0a54e195-03e2-40bd-869d-b71cb302783e'),
    updatedTime?: string(name='UpdatedTime', description='更新时间 (UTC+8)。', example='2020-01-01 12:00:00'),
  }(name='Data', description='返回数据。'),
  errorCode?: int32(name='ErrorCode', description='错误码。', example='0'),
  errorMessage?: string(name='ErrorMessage', description='错误信息。', example='OK'),
  requestId?: string(name='RequestId', description='请求ID。', example='f8651828-609d-4de8-ab49-ab781d7fd85a'),
}

model GetScheduleResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: GetScheduleResponseBody(name='body'),
}

async function getScheduleWithOptions(Id: string, headers: map[string]string, runtime: Util.RuntimeOptions): GetScheduleResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'GetSchedule',
    version = '2022-01-12',
    protocol = 'HTTPS',
    pathname = `/api/v2/schedules/${OpenApiUtil.getEncodeParam(Id)}`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function getSchedule(Id: string): GetScheduleResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return getScheduleWithOptions(Id, headers, runtime);
}

model GetSignatureResponseBody = {
  data?: {
    createdTime?: string(name='CreatedTime', description='创建时间 (UTC+8)。', example='2020-01-01 12:00:00'),
    description?: string(name='Description', description='申请说明。', example='申请说明'),
    id?: string(name='Id', description='签名Id。', example='0a54e195-03e2-40bd-869d-b71cb302783e'),
    name?: string(name='Name', description='签名名称。', example='用户增长'),
    reason?: string(name='Reason', description='审核建议。', example='同意'),
    status?: int32(name='Status', description='签名审核状态。
- 0：审核中。
- 1：审核通过。
- 2：审核不通过。', example='0'),
    updatedTime?: string(name='UpdatedTime', description='更新时间 (UTC+8)。', example='2020-01-01 12:00:00'),
  }(name='Data', description='返回数据。'),
  errorCode?: int32(name='ErrorCode', description='错误码。', example='0'),
  errorMessage?: string(name='ErrorMessage', description='错误信息。', example='OK'),
  requestId?: string(name='RequestId', description='请求ID。', example='f8651828-609d-4de8-ab49-ab781d7fd85a'),
}

model GetSignatureResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: GetSignatureResponseBody(name='body'),
}

/**
  * 获取签名详情。
  *
  * @param headers map
  * @param runtime runtime options for this request RuntimeOptions
  * @return GetSignatureResponse
 */
async function getSignatureWithOptions(Id: string, headers: map[string]string, runtime: Util.RuntimeOptions): GetSignatureResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'GetSignature',
    version = '2022-01-12',
    protocol = 'HTTPS',
    pathname = `/api/v2/signatures/${OpenApiUtil.getEncodeParam(Id)}`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
  * 获取签名详情。
  *
  * @return GetSignatureResponse
 */
async function getSignature(Id: string): GetSignatureResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return getSignatureWithOptions(Id, headers, runtime);
}

model GetTemplateResponseBody = {
  data?: {
    content?: string(name='Content', description='模板内容。', example='心仪的TA刚刚给你留言了'),
    createdTime?: string(name='CreatedTime', description='创建时间 (UTC+8)。', example='2020-01-01 12:00:00'),
    description?: string(name='Description', description='申请说明。', example='申请说明'),
    id?: string(name='Id', description='模板Id。', example='0a54e195-03e2-40bd-869d-b71cb302783e'),
    name?: string(name='Name', description='签名名称。', example='模板召回-20220101'),
    reason?: string(name='Reason', description='审核意见。', example='同意'),
    signatureId?: string(name='SignatureId', description='签名Id。', example='5480e3e7-f578-42d2-8ce8-217dec75f2e6'),
    status?: int32(name='Status', description='审核状态。
- 0 : 审核中。
- 1 : 审核通过。
- 2 : 审核不通过。', example='0'),
    templateCode?: string(name='TemplateCode', description='模板Code。', example='SMS_123456'),
    type?: int32(name='Type', description='模板类型。
- 0 : 验证码。
- 1 : 短信通知。
- 2 : 推广短信。', example='1'),
    updatedTime?: string(name='UpdatedTime', description='更新时间 (UTC+8)。', example='2020-01-01 12:00:00'),
  }(name='Data', description='返回数据。'),
  errorCode?: int32(name='ErrorCode', description='错误码。', example='0'),
  errorMessage?: string(name='ErrorMessage', description='错误信息。', example='OK'),
  requestId?: string(name='RequestId', description='请求ID。', example='f8651828-609d-4de8-ab49-ab781d7fd85a'),
}

model GetTemplateResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: GetTemplateResponseBody(name='body'),
}

/**
  * 获取模板详情。
  *
  * @param headers map
  * @param runtime runtime options for this request RuntimeOptions
  * @return GetTemplateResponse
 */
async function getTemplateWithOptions(Id: string, headers: map[string]string, runtime: Util.RuntimeOptions): GetTemplateResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'GetTemplate',
    version = '2022-01-12',
    protocol = 'HTTPS',
    pathname = `/api/v2/templates/${OpenApiUtil.getEncodeParam(Id)}`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
  * 获取模板详情。
  *
  * @return GetTemplateResponse
 */
async function getTemplate(Id: string): GetTemplateResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return getTemplateWithOptions(Id, headers, runtime);
}

model GetTrainingJobResponseBody = {
  data?: {
    algorithm?: string(name='Algorithm', description='关联算法ID。', example='user_recall'),
    campaignId?: string(name='CampaignId', description='关联运营活动ID。', example='0a54e195-03e2-40bd-869d-b71cb302783e'),
    createdTime?: string(name='CreatedTime', description='创建时间 (UTC+8)。', example='2020-01-01 12:00:00'),
    dataPath?: string(name='DataPath', description='训练数据路径，指定路径前需确保已在控制台完成一键授权。', example='https://bucket.region.aliyuncs.com/folder/'),
    hasModelInfo?: boolean(name='HasModelInfo'),
    history?: string(name='History', description='训练任务日志。', example='Error: Missing column.'),
    id?: string(name='Id', description='训练任务ID。', example='0a54e195-03e2-40bd-869d-b71cb302783e'),
    name?: string(name='Name', description='训练任务名称。', example='VIP客户'),
    remark?: string(name='Remark', description='备注。', example='充值大于一万'),
    status?: int32(name='Status', description='训练任务状态。
- 0: 队列中。
- 1: 已提交。
- 2: 运行中。
- 3: 成功。
- 4: 失败。', example='3'),
    trainingScheduleId?: string(name='TrainingScheduleId', description='关联训练计划ID。', example='0a54e195-03e2-40bd-869d-b71cb302783e'),
    updatedTime?: string(name='UpdatedTime', description='更新时间 (UTC+8)。', example='2020-01-01 12:00:00'),
    userConfig?: string(name='UserConfig', description='用户配置。', example='{}'),
  }(name='Data', description='返回数据。'),
  errorCode?: int32(name='ErrorCode', description='错误码。', example='0'),
  errorMessage?: string(name='ErrorMessage', description='错误信息。', example='OK'),
  requestId?: string(name='RequestId', description='请求ID。', example='f8651828-609d-4de8-ab49-ab781d7fd85a'),
}

model GetTrainingJobResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: GetTrainingJobResponseBody(name='body'),
}

async function getTrainingJobWithOptions(Id: string, headers: map[string]string, runtime: Util.RuntimeOptions): GetTrainingJobResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'GetTrainingJob',
    version = '2022-01-12',
    protocol = 'HTTPS',
    pathname = `/api/v2/training/jobs/${OpenApiUtil.getEncodeParam(Id)}`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function getTrainingJob(Id: string): GetTrainingJobResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return getTrainingJobWithOptions(Id, headers, runtime);
}

model GetUserResponseBody = {
  data?: {
    accountStatus?: int32(name='AccountStatus', description='账号状态。
- 0 : 正常使用。
- 1 : 因欠费等原因暂时停用。
- 2 : 已释放产品。', example='0'),
  }(name='Data', description='返回数据。'),
  errorCode?: int32(name='ErrorCode', description='错误码。', example='0'),
  errorMessage?: string(name='ErrorMessage', description='错误信息。', example='OK'),
  requestId?: string(name='RequestId', description='请求ID。', example='f8651828-609d-4de8-ab49-ab781d7fd85a'),
}

model GetUserResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: GetUserResponseBody(name='body'),
}

/**
  * 获取账号状态。
  *
  * @param headers map
  * @param runtime runtime options for this request RuntimeOptions
  * @return GetUserResponse
 */
async function getUserWithOptions(headers: map[string]string, runtime: Util.RuntimeOptions): GetUserResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'GetUser',
    version = '2022-01-12',
    protocol = 'HTTPS',
    pathname = `/api/v2/users`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
  * 获取账号状态。
  *
  * @return GetUserResponse
 */
async function getUser(): GetUserResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return getUserWithOptions(headers, runtime);
}

model ListAlgorithmsRequest {
  id?: string(name='Id', description='算法Id过滤。', example='sms_recall'),
  name?: string(name='Name', description='算法名称过滤。', example='短信召回'),
  pageNumber?: int32(name='PageNumber', description='分页数，从1开始，默认为1。', example='1'),
  pageSize?: int32(name='PageSize', description='分页大小，默认为10。', example='10'),
}

model ListAlgorithmsResponseBody = {
  data?: {
    algorithms?: [ 
      {
        id?: string(name='Id', description='算法Id。', example='sms_recall'),
        name?: string(name='Name', description='算法名称。', example='短信召回'),
      }
    ](name='Algorithms', description='算法列表。'),
    pageNumber?: int32(name='PageNumber', description='分页数，从1开始，默认为1。', example='1'),
    pageSize?: int32(name='PageSize', description='分页大小，默认为10。', example='10'),
    totalCount?: int32(name='TotalCount', description='总算法数量。', example='10'),
  }(name='Data', description='返回数据。'),
  errorCode?: int32(name='ErrorCode', description='错误码。', example='0'),
  errorMessage?: string(name='ErrorMessage', description='错误信息。', example='OK'),
  requestId?: string(name='RequestId', description='请求ID。', example='f8651828-609d-4de8-ab49-ab781d7fd85a'),
}

model ListAlgorithmsResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ListAlgorithmsResponseBody(name='body'),
}

/**
  * 获取算法列表。
  *
  * @param request ListAlgorithmsRequest
  * @param headers map
  * @param runtime runtime options for this request RuntimeOptions
  * @return ListAlgorithmsResponse
 */
async function listAlgorithmsWithOptions(request: ListAlgorithmsRequest, headers: map[string]string, runtime: Util.RuntimeOptions): ListAlgorithmsResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.id)) {
    query['Id'] = request.id;
  }
  if (!Util.isUnset(request.name)) {
    query['Name'] = request.name;
  }
  if (!Util.isUnset(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListAlgorithms',
    version = '2022-01-12',
    protocol = 'HTTPS',
    pathname = `/api/v2/algorithms`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
  * 获取算法列表。
  *
  * @param request ListAlgorithmsRequest
  * @return ListAlgorithmsResponse
 */
async function listAlgorithms(request: ListAlgorithmsRequest): ListAlgorithmsResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return listAlgorithmsWithOptions(request, headers, runtime);
}

model ListCampaignsRequest {
  name?: string(name='Name', description='运营活动名称过滤。', example='VIP客户'),
  pageNumber?: int32(name='PageNumber', description='分页数，从1开始，默认为1。', example='1'),
  pageSize?: int32(name='PageSize', description='分页大小，默认为10。', example='10'),
  remark?: string(name='Remark', description='运营活动备注过滤。', example='充值大于一万'),
}

model ListCampaignsResponseBody = {
  data?: {
    campaigns?: [ 
      {
        createdTime?: string(name='CreatedTime', description='创建时间 (UTC+8)。', example='2020-01-01 12:00:00'),
        id?: string(name='Id', description='运营活动Id。', example='0a54e195-03e2-40bd-869d-b71cb302783e'),
        name?: string(name='Name', description='运营活动名称。', example='VIP客户'),
        remark?: string(name='Remark', description='备注。', example='双十一活动'),
        updatedTime?: string(name='UpdatedTime', description='更新时间 (UTC+8)。', example='2020-01-01 12:00:00'),
      }
    ](name='Campaigns', description='运营活动列表。'),
    pageNumber?: int32(name='PageNumber', description='分页数，从1开始，默认为1。', example='1'),
    pageSize?: int32(name='PageSize', description='分页大小，默认为10。', example='10'),
    totalCount?: int32(name='TotalCount', description='总运营活动数量。', example='10'),
  }(name='Data', description='返回数据。'),
  errorCode?: int32(name='ErrorCode', description='错误码。', example='0'),
  errorMessage?: string(name='ErrorMessage', description='错误信息。', example='OK'),
  requestId?: string(name='RequestId', description='请求ID。', example='f8651828-609d-4de8-ab49-ab781d7fd85a'),
}

model ListCampaignsResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ListCampaignsResponseBody(name='body'),
}

/**
  * 获取运营活动列表。
  *
  * @param request ListCampaignsRequest
  * @param headers map
  * @param runtime runtime options for this request RuntimeOptions
  * @return ListCampaignsResponse
 */
async function listCampaignsWithOptions(request: ListCampaignsRequest, headers: map[string]string, runtime: Util.RuntimeOptions): ListCampaignsResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.name)) {
    query['Name'] = request.name;
  }
  if (!Util.isUnset(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.remark)) {
    query['Remark'] = request.remark;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListCampaigns',
    version = '2022-01-12',
    protocol = 'HTTPS',
    pathname = `/api/v2/campaigns`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
  * 获取运营活动列表。
  *
  * @param request ListCampaignsRequest
  * @return ListCampaignsResponse
 */
async function listCampaigns(request: ListCampaignsRequest): ListCampaignsResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return listCampaignsWithOptions(request, headers, runtime);
}

model ListGroupsRequest {
  name?: string(name='Name', description='人群名称过滤。', example='VIP客户'),
  pageNumber?: int32(name='PageNumber', description='分页数，从1开始，默认为1。', example='1'),
  pageSize?: int32(name='PageSize', description='分页大小，默认为10。', example='10'),
  phoneNumber?: boolean(name='PhoneNumber', description='是否包含手机号过滤。', example='true'),
  remark?: string(name='Remark', description='人群备注过滤。', example='充值大于一万'),
  source?: int32(name='Source', description='来源过滤。', example='0'),
  status?: int32(name='Status', description='审核状态过滤。', example='0'),
}

model ListGroupsResponseBody = {
  data?: {
    groups?: [ 
      {
        algorithm?: string(name='Algorithm', description='关联算法，人群来源为算法。', example='user_recall'),
        amount?: int32(name='Amount', description='人群数量。', example='0'),
        column?: string(name='Column', description='手机号列名，人群来源为CSV文件，MaxCompute，并且包含手机号时需指定。', example='phone'),
        createdTime?: string(name='CreatedTime', description='创建时间 (UTC+8)。', example='2020-01-01 12:00:00'),
        filter?: string(name='Filter', description='过滤条件，人群来源为MaxCompute时可指定。', example='ds=2022'),
        id?: string(name='Id', description='人群Id。', example='0a54e195-03e2-40bd-869d-b71cb302783e'),
        inferenceJobId?: string(name='InferenceJobId', description='预测任务Id，人群来源为算法。', example='0a54e195-03e2-40bd-869d-b71cb302783e'),
        name?: string(name='Name', description='人群名称。', example='VIP客户'),
        phoneNumber?: boolean(name='PhoneNumber', description='是否包含手机号，包含手机号的人群可用于触达计划。', example='true'),
        project?: string(name='Project', description='MaxCompute(ODPS)项目名，人群来源为MaxCompute时需指定。', example='project'),
        remark?: string(name='Remark', description='人群备注。', example='充值大于10万'),
        source?: int32(name='Source', description='人群来源。
- 0: 文本，每行一个手机号，最多100个。
- 1: 文本文件，每行一个手机号，可通过控制台上传或指定自定义OSS地址，指定自定义OSS地址前需确保已在控制台完成一键授权。
- 2: CSV文件，需指定手机号列名，可通过控制台上传或指定自定义OSS地址，指定自定义OSS地址前需确保已在控制台完成一键授权。
- 3: MaxCompute(ODPS)表，需指定手机号列名。
- 4: 算法。', example='0'),
        status?: int32(name='Status', description='人群状态。
- 0: 检查中。
- 1: 已通过。
- 2: 未通过。', example='0'),
        table?: string(name='Table', description='MaxCompute(ODPS)表名，人群来源为MaxCompute时需指定。', example='recall'),
        text?: string(name='Text', description='文本，人群来源为文本时需指定。', example='1390000****'),
        updatedTime?: string(name='UpdatedTime', description='更新时间 (UTC+8)。', example='2020-01-01 12:00:00'),
        uri?: string(name='Uri', description='文件地址，人群来源为文本文件，CSV文件，MaxCompute时需指定。', example='https://bucket.region.aliyuncs.com/folder/file'),
      }
    ](name='Groups', description='人群列表。'),
    pageNumber?: int32(name='PageNumber', description='分页数，从1开始，默认为1。', example='1'),
    pageSize?: int32(name='PageSize', description='分页大小，默认为10。', example='10'),
    totalCount?: int32(name='TotalCount', description='总人群数量。', example='10'),
  }(name='Data', description='返回数据。'),
  errorCode?: int32(name='ErrorCode', description='错误码。', example='0'),
  errorMessage?: string(name='ErrorMessage', description='错误信息。', example='OK'),
  requestId?: string(name='RequestId', description='请求ID。', example='f8651828-609d-4de8-ab49-ab781d7fd85a'),
}

model ListGroupsResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ListGroupsResponseBody(name='body'),
}

/**
  * 获取人群列表。
  *
  * @param request ListGroupsRequest
  * @param headers map
  * @param runtime runtime options for this request RuntimeOptions
  * @return ListGroupsResponse
 */
async function listGroupsWithOptions(request: ListGroupsRequest, headers: map[string]string, runtime: Util.RuntimeOptions): ListGroupsResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.name)) {
    query['Name'] = request.name;
  }
  if (!Util.isUnset(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.phoneNumber)) {
    query['PhoneNumber'] = request.phoneNumber;
  }
  if (!Util.isUnset(request.remark)) {
    query['Remark'] = request.remark;
  }
  if (!Util.isUnset(request.source)) {
    query['Source'] = request.source;
  }
  if (!Util.isUnset(request.status)) {
    query['Status'] = request.status;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListGroups',
    version = '2022-01-12',
    protocol = 'HTTPS',
    pathname = `/api/v2/groups`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
  * 获取人群列表。
  *
  * @param request ListGroupsRequest
  * @return ListGroupsResponse
 */
async function listGroups(request: ListGroupsRequest): ListGroupsResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return listGroupsWithOptions(request, headers, runtime);
}

model ListInferenceJobsRequest {
  campaignId?: string(name='CampaignId', description='归属运营活动过滤。', example='0a54e195-03e2-40bd-869d-b71cb302783e'),
  campaignName?: string(name='CampaignName', example='双11活动'),
  name?: string(name='Name', description='预测任务名称过滤。', example='VIP客户'),
  pageNumber?: int32(name='PageNumber', description='分页数，从1开始，默认为1。', example='1'),
  pageSize?: int32(name='PageSize', description='分页大小，默认为10。', example='10'),
  remark?: string(name='Remark', description='预测任务备注过滤。', example='充值大于一万'),
  status?: int32(name='Status', description='预测任务状态过滤。
- 0: 队列中。
- 1: 已提交。
- 2: 运行中。
- 3: 成功。
- 4: 失败。', example='0'),
  trainingJobName?: string(name='TrainingJobName', example='test_job'),
}

model ListInferenceJobsResponseBody = {
  data?: {
    inferenceJobs?: [ 
      {
        algorithm?: string(name='Algorithm', description='关联算法。', example='user_recall'),
        campaignId?: string(name='CampaignId', description='关联运营活动ID。', example='0a54e195-03e2-40bd-869d-b71cb302783e'),
        createdTime?: string(name='CreatedTime', description='创建时间 (UTC+8)。', example='2020-01-01 12:00:00'),
        dataPath?: string(name='DataPath', description='预测数据路径，当预测人群数据分布在多个csv文件时可指定目录，指定路径前需确保已在控制台完成一键授权。', example='https://bucket.region.aliyuncs.com/folder/'),
        groupId?: string(name='GroupId', description='预测人群，人群来源必须为多列csv，当同时指定DataPath与GroupId时，以GroupId为准。', example='0a54e195-03e2-40bd-869d-b71cb302783e'),
        history?: string(name='History', description='预测任务日志。', example='Error: Missing Column.'),
        id?: string(name='Id', description='预测任务ID。', example='0a54e195-03e2-40bd-869d-b71cb302783e'),
        name?: string(name='Name', description='预测任务名称。', example='VIP客户'),
        remark?: string(name='Remark', description='备注。', example='充值大于一万'),
        status?: int32(name='Status', description='预测任务状态。
- 0: 队列中。
- 1: 已提交。
- 2: 运行中。
- 3: 成功。
- 4: 失败。', example='3'),
        targetGroupId?: string(name='TargetGroupId', description='关联目标人群ID，如果任务失败则人群无效。', example='0a54e195-03e2-40bd-869d-b71cb302783e'),
        targetPath?: string(name='TargetPath', description='输出数据路径，需要为空目录，指定路径前需确保已在控制台完成一键授权。', example='https://bucket.region.aliyuncs.com/folder/'),
        trainingJobId?: string(name='TrainingJobId', description='关联训练任务。', example='123'),
        updatedTime?: string(name='UpdatedTime', description='更新时间 (UTC+8)。', example='2020-01-01 12:00:00'),
        userConfig?: string(name='UserConfig', description='用户配置。', example='{}'),
      }
    ](name='InferenceJobs', description='预测任务列表。'),
    pageNumber?: int32(name='PageNumber', description='分页数，从1开始，默认为1。', example='1'),
    pageSize?: int32(name='PageSize', description='分页大小，默认为10。', example='10'),
    totalCount?: int32(name='TotalCount', description='总预测任务数量。', example='10'),
  }(name='Data', description='返回数据。'),
  errorCode?: int32(name='ErrorCode', description='错误码。', example='0'),
  errorMessage?: string(name='ErrorMessage', description='错误信息。', example='OK'),
  requestId?: string(name='RequestId', description='请求ID。', example='f8651828-609d-4de8-ab49-ab781d7fd85a'),
}

model ListInferenceJobsResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ListInferenceJobsResponseBody(name='body'),
}

async function listInferenceJobsWithOptions(request: ListInferenceJobsRequest, headers: map[string]string, runtime: Util.RuntimeOptions): ListInferenceJobsResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.campaignId)) {
    query['CampaignId'] = request.campaignId;
  }
  if (!Util.isUnset(request.campaignName)) {
    query['CampaignName'] = request.campaignName;
  }
  if (!Util.isUnset(request.name)) {
    query['Name'] = request.name;
  }
  if (!Util.isUnset(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.remark)) {
    query['Remark'] = request.remark;
  }
  if (!Util.isUnset(request.status)) {
    query['Status'] = request.status;
  }
  if (!Util.isUnset(request.trainingJobName)) {
    query['TrainingJobName'] = request.trainingJobName;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListInferenceJobs',
    version = '2022-01-12',
    protocol = 'HTTPS',
    pathname = `/api/v2/inference/jobs`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function listInferenceJobs(request: ListInferenceJobsRequest): ListInferenceJobsResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return listInferenceJobsWithOptions(request, headers, runtime);
}

model ListMessageMetricsRequest {
  endDate?: string(name='EndDate', description='结束日期，格式20220102。', example='20210321'),
  groupId?: string(name='GroupId', description='关联人群Id。', example='10ed87f5-3ca8-4a43-9d83-b30519be7241'),
  pageNumber?: int32(name='PageNumber', description='分页数，从1开始，默认为1。', example='1'),
  pageSize?: int32(name='PageSize', description='分页大小，默认为10。', example='10'),
  scheduleId?: string(name='ScheduleId', description='关联触达计划Id。', example='08d19262-bd76-48fd-80e8-6a225ac388c1'),
  signature?: string(name='Signature', description='签名名称。', example='PAI通知'),
  signatureId?: string(name='SignatureId', description='签名Id，同时只能指定签名名称或签名Id其中之一。', example='b1fe24e2-6a1b-42c6-901e-bfb2e898b5f3'),
  startDate?: string(name='StartDate', description='开始日期，格式20220102。', example='20210321'),
  templateCode?: string(name='TemplateCode', description='模板号。', example='SMS_123456'),
  templateId?: string(name='TemplateId', description='模板Id，同时只能指定模板Code或模板Id其中之一。', example='5480e3e7-f578-42d2-8ce8-217dec75f2e6'),
  templateType?: int32(name='TemplateType', description='模板类型。
- 0 : 验证码。
- 1 : 短信通知。
- 2 : 推广短信。', example='2'),
}

model ListMessageMetricsResponseBody = {
  data?: {
    metrics?: [ 
      {
        date?: string(name='Date', description='发送日期。', example='20210321'),
        fail?: int32(name='Fail', description='发送失败。', example='0'),
        pending?: int32(name='Pending', description='发送中。', example='0'),
        rate?: float(name='Rate', description='发送成功率。', example='0.8'),
        success?: int32(name='Success', description='发送成功。', example='0'),
        total?: int32(name='Total', description='总计短信数量。', example='0'),
      }
    ](name='Metrics', description='分页返回的统计数据条目列表。'),
    pageNumber?: int32(name='PageNumber', description='分页数，从1开始，默认为1。', example='1'),
    pageSize?: int32(name='PageSize', description='分页大小，默认为10。', example='10'),
    totalCount?: int32(name='TotalCount', description='总统计数据条目数量。', example='0'),
  }(name='Data', description='返回数据。'),
  errorCode?: int32(name='ErrorCode', description='错误码。', example='0'),
  errorMessage?: string(name='ErrorMessage', description='错误信息。', example='OK'),
  requestId?: string(name='RequestId', description='请求ID。', example='f8651828-609d-4de8-ab49-ab781d7fd85a'),
}

model ListMessageMetricsResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ListMessageMetricsResponseBody(name='body'),
}

/**
  * 获取短信发送统计列表。
  * 获取短信发送统计数据，可按指定条件获取分类别详细数据，返回数据按日期顺序排列，发送统计为空的日期默认不返回。
  * 发送数据在48小时内会随实际短信发送状态不断更新，最终数据以48小时后数据为准。
  *
  * @param request ListMessageMetricsRequest
  * @param headers map
  * @param runtime runtime options for this request RuntimeOptions
  * @return ListMessageMetricsResponse
 */
async function listMessageMetricsWithOptions(request: ListMessageMetricsRequest, headers: map[string]string, runtime: Util.RuntimeOptions): ListMessageMetricsResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.endDate)) {
    query['EndDate'] = request.endDate;
  }
  if (!Util.isUnset(request.groupId)) {
    query['GroupId'] = request.groupId;
  }
  if (!Util.isUnset(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.scheduleId)) {
    query['ScheduleId'] = request.scheduleId;
  }
  if (!Util.isUnset(request.signature)) {
    query['Signature'] = request.signature;
  }
  if (!Util.isUnset(request.signatureId)) {
    query['SignatureId'] = request.signatureId;
  }
  if (!Util.isUnset(request.startDate)) {
    query['StartDate'] = request.startDate;
  }
  if (!Util.isUnset(request.templateCode)) {
    query['TemplateCode'] = request.templateCode;
  }
  if (!Util.isUnset(request.templateId)) {
    query['TemplateId'] = request.templateId;
  }
  if (!Util.isUnset(request.templateType)) {
    query['TemplateType'] = request.templateType;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListMessageMetrics',
    version = '2022-01-12',
    protocol = 'HTTPS',
    pathname = `/api/v2/messages/metrics`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
  * 获取短信发送统计列表。
  * 获取短信发送统计数据，可按指定条件获取分类别详细数据，返回数据按日期顺序排列，发送统计为空的日期默认不返回。
  * 发送数据在48小时内会随实际短信发送状态不断更新，最终数据以48小时后数据为准。
  *
  * @param request ListMessageMetricsRequest
  * @return ListMessageMetricsResponse
 */
async function listMessageMetrics(request: ListMessageMetricsRequest): ListMessageMetricsResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return listMessageMetricsWithOptions(request, headers, runtime);
}

model ListMessagesRequest {
  datetime?: string(name='Datetime', description='发送日期，格式为20220101。', example='20220101'),
  errorCode?: string(name='ErrorCode', description='短信错误码过滤。', example='DELIVERED'),
  groupId?: string(name='GroupId', description='关联人群Id过滤。', example='10ed87f5-3ca8-4a43-9d83-b30519be7241'),
  messageId?: string(name='MessageId', description='短信Id过滤，短信Id为SendMessage成功返回的Id。', example='0a54e195-03e2-40bd-869d-b71cb302783e'),
  pageNumber?: int32(name='PageNumber', description='分页数，从1开始，默认为1。', example='1'),
  pageSize?: int32(name='PageSize', description='分页大小，默认为10。', example='10'),
  phoneNumber?: string(name='PhoneNumber', description='手机号码过滤。', example='1234567890'),
  requestId?: string(name='RequestId', description='短信批处理Id过滤，短信批处理Id为SendMessage成功返回的RequestId。', example='62a72a20-8a9b-4060-a510-0c30a9340cba'),
  scheduleId?: string(name='ScheduleId', description='关联触达计划Id过滤。', example='08d19262-bd76-48fd-80e8-6a225ac388c1'),
  signature?: string(name='Signature', description='签名名称过滤。', example='PAI通知'),
  signatureId?: string(name='SignatureId', description='签名Id过滤，同时只能指定签名名称或签名Id其中之一。', example='5480e3e7-f578-42d2-8ce8-217dec75f2e6'),
  status?: int32(name='Status', description='短信发送状态过滤。
- 0 : 发送中。
- 1 : 发送成功。
- 2 : 发送失败。', example='0'),
  templateCode?: string(name='TemplateCode', description='模板号过滤。', example='SMS_123456'),
  templateId?: string(name='TemplateId', description='模板Id过滤，同时只能指定模板Code或模板Id其中之一。', example='b1fe24e2-6a1b-42c6-901e-bfb2e898b5f3'),
  templateType?: int32(name='TemplateType', description='模板类型过滤。
- 0 : 验证码。
- 1 : 短信通知。
- 2 : 推广短信。', example='2'),
}

model ListMessagesResponseBody = {
  data?: {
    messages?: [ 
      {
        errorCode?: string(name='ErrorCode', description='短信错误码。', example='DELIVERED'),
        groupId?: string(name='GroupId', description='关联人群Id，未关联则为空。', example='51d20163-1b10-4af2-8a23-58ad52201f2f'),
        id?: string(name='Id', description='短信序列号。', example='92d05e19-751b-4346-a7c5-8808bb49b8a2'),
        outId?: string(name='OutId', description='外部拓展字段。', example='1234567890'),
        phoneNumber?: string(name='PhoneNumber', description='手机号码。', example='1234567890'),
        scheduleId?: string(name='ScheduleId', description='关联触达计划Id，未关联则为空。', example='0604d49d-fd23-4515-bb26-9b537cbf1f6d'),
        signature?: string(name='Signature', description='签名名称。', example='PAI通知'),
        status?: int32(name='Status', description='短信发送状态。
- 0 : 发送中。
- 1 : 发送成功。
- 2 : 发送失败。', example='0'),
        templateCode?: string(name='TemplateCode', description='模板号。', example='SMS_123456'),
        templateParams?: string(name='TemplateParams', description='模板参数。', example='{}'),
        templateType?: int32(name='TemplateType', description='模板类型。
- 0 : 验证码。
- 1 : 短信通知。
- 2 : 推广短信。', example='2'),
      }
    ](name='Messages', description='短信列表。'),
    pageNumber?: int32(name='PageNumber', description='分页数，从1开始，默认为1。', example='1'),
    pageSize?: int32(name='PageSize', description='分页大小，默认为10。', example='10'),
    totalCount?: int32(name='TotalCount', description='短信数量。', example='10'),
  }(name='Data', description='返回数据。'),
  errorCode?: int32(name='ErrorCode', description='错误码。', example='0'),
  errorMessage?: string(name='ErrorMessage', description='错误信息。', example='OK'),
  requestId?: string(name='RequestId', description='请求ID。', example='f8651828-609d-4de8-ab49-ab781d7fd85a'),
}

model ListMessagesResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ListMessagesResponseBody(name='body'),
}

/**
  * 查询短信发送详情列表。
  *
  * @param request ListMessagesRequest
  * @param headers map
  * @param runtime runtime options for this request RuntimeOptions
  * @return ListMessagesResponse
 */
async function listMessagesWithOptions(request: ListMessagesRequest, headers: map[string]string, runtime: Util.RuntimeOptions): ListMessagesResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.datetime)) {
    query['Datetime'] = request.datetime;
  }
  if (!Util.isUnset(request.errorCode)) {
    query['ErrorCode'] = request.errorCode;
  }
  if (!Util.isUnset(request.groupId)) {
    query['GroupId'] = request.groupId;
  }
  if (!Util.isUnset(request.messageId)) {
    query['MessageId'] = request.messageId;
  }
  if (!Util.isUnset(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.phoneNumber)) {
    query['PhoneNumber'] = request.phoneNumber;
  }
  if (!Util.isUnset(request.requestId)) {
    query['RequestId'] = request.requestId;
  }
  if (!Util.isUnset(request.scheduleId)) {
    query['ScheduleId'] = request.scheduleId;
  }
  if (!Util.isUnset(request.signature)) {
    query['Signature'] = request.signature;
  }
  if (!Util.isUnset(request.signatureId)) {
    query['SignatureId'] = request.signatureId;
  }
  if (!Util.isUnset(request.status)) {
    query['Status'] = request.status;
  }
  if (!Util.isUnset(request.templateCode)) {
    query['TemplateCode'] = request.templateCode;
  }
  if (!Util.isUnset(request.templateId)) {
    query['TemplateId'] = request.templateId;
  }
  if (!Util.isUnset(request.templateType)) {
    query['TemplateType'] = request.templateType;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListMessages',
    version = '2022-01-12',
    protocol = 'HTTPS',
    pathname = `/api/v2/messages`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
  * 查询短信发送详情列表。
  *
  * @param request ListMessagesRequest
  * @return ListMessagesResponse
 */
async function listMessages(request: ListMessagesRequest): ListMessagesResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return listMessagesWithOptions(request, headers, runtime);
}

model ListSchedulesRequest {
  name?: string(name='Name', description='触达计划名称过滤。', example='用户增长'),
  pageNumber?: int32(name='PageNumber', description='分页数，从1开始，默认为1。', example='1'),
  pageSize?: int32(name='PageSize', description='分页大小，默认为10。', example='10'),
  status?: int32(name='Status', description='发送状态过滤。', example='0'),
}

model ListSchedulesResponseBody = {
  data?: {
    pageNumber?: int32(name='PageNumber', description='分页数，从1开始，默认为1。', example='1'),
    pageSize?: int32(name='PageSize', description='分页大小，默认为10。', example='10'),
    schedules?: [ 
      {
        createdTime?: string(name='CreatedTime', description='创建时间 (UTC+8)。', example='2020-01-01 12:00:00'),
        endTime?: int32(name='EndTime', description='终止时间（UTC+8）。', example='2020-01-01'),
        executeTime?: string(name='ExecuteTime', description='执行时间 (UTC+8)，为空立即执行。', example='2020-01-01 12:00:00'),
        groupId?: string(name='GroupId', description='人群ID。', example='0a54e195-03e2-40bd-869d-b71cb302783e'),
        id?: string(name='Id', description='触达计划ID。', example='0a54e195-03e2-40bd-869d-b71cb302783e'),
        name?: string(name='Name', description='触达计划名称。', example='增长-2021-0101'),
        repeatCycle?: int32(name='RepeatCycle', description='重复周期，按重复周期与重复周期单位执行。', example='0'),
        repeatCycleUnit?: int32(name='RepeatCycleUnit', description='重复周期单位，若指定执行时间，则重复周期生效。
- 0: 从不（默认）。
- 1: 小时。
- 2: 天。
- 3: 周。
- 4: 月。', example='0'),
        repeatTimes?: int32(name='RepeatTimes', description='重复次数。
- 0: 不设终止时间（默认）。
- N: 重复N次后终止。', example='1'),
        signName?: string(name='SignName', description='签名。', example='PAI'),
        signatureId?: string(name='SignatureId', description='签名ID，或指定签名。', example='0a54e195-03e2-40bd-869d-b71cb302783e'),
        status?: int32(name='Status', description='状态。
- 0: 检查中。
- 1: 检查成功。
- 2: 检查失败。
- 3: 发送中。
- 4: 发送成功。
- 5: 发送失败。', example='0'),
        templateCode?: string(name='TemplateCode', description='模板Code。', example='SMS_123456'),
        templateId?: string(name='TemplateId', description='模板ID，或指定模板Code。', example='0a54e195-03e2-40bd-869d-b71cb302783e'),
        updatedTime?: string(name='UpdatedTime', description='更新时间 (UTC+8)。', example='2020-01-01 12:00:00'),
      }
    ](name='Schedules', description='触达计划列表。'),
    totalCount?: int32(name='TotalCount', description='触达计划数量。', example='0'),
  }(name='Data', description='返回数据。'),
  errorCode?: int32(name='ErrorCode', description='错误码。', example='0'),
  errorMessage?: string(name='ErrorMessage', description='错误信息。', example='OK'),
  requestId?: string(name='RequestId', description='请求ID。', example='f8651828-609d-4de8-ab49-ab781d7fd85a'),
}

model ListSchedulesResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ListSchedulesResponseBody(name='body'),
}

async function listSchedulesWithOptions(request: ListSchedulesRequest, headers: map[string]string, runtime: Util.RuntimeOptions): ListSchedulesResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.name)) {
    query['Name'] = request.name;
  }
  if (!Util.isUnset(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.status)) {
    query['Status'] = request.status;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListSchedules',
    version = '2022-01-12',
    protocol = 'HTTPS',
    pathname = `/api/v2/schedules`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function listSchedules(request: ListSchedulesRequest): ListSchedulesResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return listSchedulesWithOptions(request, headers, runtime);
}

model ListSignaturesRequest {
  name?: string(name='Name', description='签名名称过滤。', example='用户增长'),
  pageNumber?: int32(name='PageNumber', description='分页数，从1开始，默认为1。', example='1'),
  pageSize?: int32(name='PageSize', description='分页大小，默认为10。', example='10'),
  status?: int32(name='Status', description='签名审核状态过滤。
- 0：审核中。
- 1：审核通过。
- 2：审核不通过。', example='0'),
}

model ListSignaturesResponseBody = {
  data?: {
    pageNumber?: int32(name='PageNumber', description='分页数，从1开始，默认为1。', example='1'),
    pageSize?: int32(name='PageSize', description='分页大小，默认为10。', example='10'),
    signatures?: [ 
      {
        createdTime?: string(name='CreatedTime', description='创建时间 (UTC+8)。', example='2020-01-01 12:00:00'),
        id?: string(name='Id', description='签名Id。', example='0a54e195-03e2-40bd-869d-b71cb302783e'),
        name?: string(name='Name', description='签名名称。', example='用户增长'),
        status?: int32(name='Status', description='签名审核状态。
- 0：审核中。
- 1：审核通过。
- 2：审核不通过。', example='0'),
        updatedTime?: string(name='UpdatedTime', description='更新时间 (UTC+8)。', example='2020-01-01 12:00:00'),
      }
    ](name='Signatures', description='分页返回的签名列表。'),
    totalCount?: int32(name='TotalCount', description='账号下全部签名注册记录数量。', example='10'),
  }(name='Data', description='返回数据。'),
  errorCode?: int32(name='ErrorCode', description='错误码。', example='0'),
  errorMessage?: string(name='ErrorMessage', description='错误信息。', example='OK'),
  requestId?: string(name='RequestId', description='请求ID。', example='f8651828-609d-4de8-ab49-ab781d7fd85a'),
}

model ListSignaturesResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ListSignaturesResponseBody(name='body'),
}

/**
  * 获取签名列表。
  *
  * @param request ListSignaturesRequest
  * @param headers map
  * @param runtime runtime options for this request RuntimeOptions
  * @return ListSignaturesResponse
 */
async function listSignaturesWithOptions(request: ListSignaturesRequest, headers: map[string]string, runtime: Util.RuntimeOptions): ListSignaturesResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.name)) {
    query['Name'] = request.name;
  }
  if (!Util.isUnset(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.status)) {
    query['Status'] = request.status;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListSignatures',
    version = '2022-01-12',
    protocol = 'HTTPS',
    pathname = `/api/v2/signatures`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
  * 获取签名列表。
  *
  * @param request ListSignaturesRequest
  * @return ListSignaturesResponse
 */
async function listSignatures(request: ListSignaturesRequest): ListSignaturesResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return listSignaturesWithOptions(request, headers, runtime);
}

model ListTemplatesRequest {
  content?: string(name='Content', description='模板内容过滤。', example='七夕'),
  name?: string(name='Name', description='模板名称过滤。', example='召回'),
  pageNumber?: int32(name='PageNumber', description='分页数，从1开始，默认为1。', example='1'),
  pageSize?: int32(name='PageSize', description='分页大小，默认为10。', example='10'),
  status?: int32(name='Status', description='审核状态过滤。
- 0 : 审核中。
- 1 : 审核通过。
- 2 : 审核不通过。', example='0'),
  type?: int32(name='Type', description='模板类型过滤。
- 0 : 验证码。
- 1 : 短信通知。
- 2 : 推广短信。', example='0'),
}

model ListTemplatesResponseBody = {
  data?: {
    pageNumber?: int32(name='PageNumber', description='分页数，从1开始，默认为1。', example='1'),
    pageSize?: int32(name='PageSize', description='分页大小，默认为10。', example='10'),
    templates?: [ 
      {
        content?: string(name='Content', description='模板内容。', example='心仪的TA刚刚给你留言了'),
        createdTime?: string(name='CreatedTime', description='创建时间 (UTC+8)。', example='2020-01-01 12:00:00'),
        description?: string(name='Description', description='申请说明。', example='申请说明'),
        id?: string(name='Id', description='模板Id。', example='0a54e195-03e2-40bd-869d-b71cb302783e'),
        name?: string(name='Name', description='签名名称。', example='模板召回-20220101'),
        reason?: string(name='Reason', description='审核意见。', example='同意'),
        signatureId?: string(name='SignatureId', description='签名Id。', example='5480e3e7-f578-42d2-8ce8-217dec75f2e6'),
        status?: int32(name='Status', description='审核状态。
- 0 : 审核中。
- 1 : 审核通过。
- 2 : 审核不通过。', example='0'),
        templateCode?: string(name='TemplateCode', description='模板Code。', example='SMS_123456'),
        type?: int32(name='Type', description='模板类型。
- 0 : 验证码。
- 1 : 短信通知。
- 2 : 推广短信。', example='1'),
        updatedTime?: string(name='UpdatedTime', description='更新时间 (UTC+8)。', example='2020-01-01 12:00:00'),
      }
    ](name='Templates', description='分页返回的模板列表。'),
    totalCount?: int32(name='TotalCount', description='全部模板注册记录数量。', example='10'),
  }(name='Data', description='返回数据。'),
  errorCode?: int32(name='ErrorCode', description='错误码。', example='0'),
  errorMessage?: string(name='ErrorMessage', description='错误信息。', example='OK'),
  requestId?: string(name='RequestId', description='请求ID。', example='f8651828-609d-4de8-ab49-ab781d7fd85a'),
}

model ListTemplatesResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ListTemplatesResponseBody(name='body'),
}

/**
  * 获取模板列表。
  *
  * @param request ListTemplatesRequest
  * @param headers map
  * @param runtime runtime options for this request RuntimeOptions
  * @return ListTemplatesResponse
 */
async function listTemplatesWithOptions(request: ListTemplatesRequest, headers: map[string]string, runtime: Util.RuntimeOptions): ListTemplatesResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.content)) {
    query['Content'] = request.content;
  }
  if (!Util.isUnset(request.name)) {
    query['Name'] = request.name;
  }
  if (!Util.isUnset(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.status)) {
    query['Status'] = request.status;
  }
  if (!Util.isUnset(request.type)) {
    query['Type'] = request.type;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListTemplates',
    version = '2022-01-12',
    protocol = 'HTTPS',
    pathname = `/api/v2/templates`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
  * 获取模板列表。
  *
  * @param request ListTemplatesRequest
  * @return ListTemplatesResponse
 */
async function listTemplates(request: ListTemplatesRequest): ListTemplatesResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return listTemplatesWithOptions(request, headers, runtime);
}

model ListTrainingJobsRequest {
  campaignId?: string(name='CampaignId', description='归属运营活动过滤。', example='0a54e195-03e2-40bd-869d-b71cb302783e'),
  campaignName?: string(name='CampaignName', example='双11活动'),
  name?: string(name='Name', description='训练任务名称过滤。', example='VIP客户'),
  pageNumber?: int32(name='PageNumber', description='分页数，从1开始，默认为1。', example='1'),
  pageSize?: int32(name='PageSize', description='分页大小，默认为10。', example='10'),
  remark?: string(name='Remark', description='训练任务备注过滤。', example='充值大于一万'),
  status?: int32(name='Status', description='训练任务状态过滤。
- 0: 队列中。
- 1: 已提交。
- 2: 运行中。
- 3: 成功。
- 4: 失败。', example='0'),
  trainingScheduleId?: string(name='TrainingScheduleId', description='归属训练计划过滤。', example='0a54e195-03e2-40bd-869d-b71cb302783e'),
}

model ListTrainingJobsResponseBody = {
  data?: {
    pageNumber?: int32(name='PageNumber', description='分页数，从1开始，默认为1。', example='1'),
    pageSize?: int32(name='PageSize', description='分页大小，默认为10。', example='10'),
    totalCount?: int32(name='TotalCount', description='总训练任务数量。', example='10'),
    trainingJobs?: [ 
      {
        algorithm?: string(name='Algorithm', description='关联算法ID。', example='user_recall'),
        campaignId?: string(name='CampaignId', description='关联运营活动ID。', example='0a54e195-03e2-40bd-869d-b71cb302783e'),
        createdTime?: string(name='CreatedTime', description='创建时间 (UTC+8)。', example='2020-01-01 12:00:00'),
        dataPath?: string(name='DataPath', description='训练数据路径，指定路径前需确保已在控制台完成一键授权。', example='https://bucket.region.aliyuncs.com/folder/'),
        hasModelInfo?: boolean(name='HasModelInfo'),
        history?: string(name='History', description='训练任务日志。', example='Error: Unknown parameter.'),
        id?: string(name='Id', description='训练任务ID。', example='0a54e195-03e2-40bd-869d-b71cb302783e'),
        name?: string(name='Name', description='训练任务名称。', example='VIP客户'),
        remark?: string(name='Remark', description='备注。', example='充值大于一万'),
        status?: int32(name='Status', description='训练任务状态。
- 0: 队列中。
- 1: 已提交。
- 2: 运行中。
- 3: 成功。
- 4: 失败。', example='3'),
        trainingScheduleId?: string(name='TrainingScheduleId', description='关联训练计划ID。', example='0a54e195-03e2-40bd-869d-b71cb302783e'),
        updatedTime?: string(name='UpdatedTime', description='更新时间 (UTC+8)。', example='2020-01-01 12:00:00'),
        userConfig?: string(name='UserConfig', description='用户配置。', example='{}'),
      }
    ](name='TrainingJobs', description='训练任务列表。'),
  }(name='Data', description='返回数据。'),
  errorCode?: int32(name='ErrorCode', description='错误码。', example='0'),
  errorMessage?: string(name='ErrorMessage', description='错误信息。', example='OK'),
  requestId?: string(name='RequestId', description='请求ID。', example='f8651828-609d-4de8-ab49-ab781d7fd85a'),
}

model ListTrainingJobsResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ListTrainingJobsResponseBody(name='body'),
}

async function listTrainingJobsWithOptions(request: ListTrainingJobsRequest, headers: map[string]string, runtime: Util.RuntimeOptions): ListTrainingJobsResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.campaignId)) {
    query['CampaignId'] = request.campaignId;
  }
  if (!Util.isUnset(request.campaignName)) {
    query['CampaignName'] = request.campaignName;
  }
  if (!Util.isUnset(request.name)) {
    query['Name'] = request.name;
  }
  if (!Util.isUnset(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.remark)) {
    query['Remark'] = request.remark;
  }
  if (!Util.isUnset(request.status)) {
    query['Status'] = request.status;
  }
  if (!Util.isUnset(request.trainingScheduleId)) {
    query['TrainingScheduleId'] = request.trainingScheduleId;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListTrainingJobs',
    version = '2022-01-12',
    protocol = 'HTTPS',
    pathname = `/api/v2/training/jobs`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function listTrainingJobs(request: ListTrainingJobsRequest): ListTrainingJobsResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return listTrainingJobsWithOptions(request, headers, runtime);
}

model SendMessageRequest {
  groupId?: string(name='GroupId', description='人群Id，用于关联人群。', example='10ed87f5-3ca8-4a43-9d83-b30519be7241'),
  outIds?: [ string ](name='OutIds', description='外部拓展字段，示例：["1234567890"]。'),
  paymentType?: string(name='PaymentType', example='PayAsYouGo'),
  phoneNumbers?: [ string ](name='PhoneNumbers', description='手机号，每个手机号对应一个模板变量、上行拓展码和外部拓展字段，示例：["1234567890"]。'),
  scheduleId?: string(name='ScheduleId', description='触达计划Id，用于关联触达计划。', example='08d19262-bd76-48fd-80e8-6a225ac388c1'),
  signName?: string(name='SignName', description='签名名称。', example='PAI通知'),
  signatureId?: string(name='SignatureId', description='签名Id，同时只能指定签名名称或签名Id其中之一。', example='5480e3e7-f578-42d2-8ce8-217dec75f2e6'),
  smsUpExtendCodes?: [ string ](name='SmsUpExtendCodes', description='短信上行拓展码，示例：["1234567890"]。'),
  templateCode?: string(name='TemplateCode', description='模板Code。', example='SMS_123456'),
  templateId?: string(name='TemplateId', description='模板Id，同时只能指定模板Code或模板Id其中之一。', example='b1fe24e2-6a1b-42c6-901e-bfb2e898b5f3'),
  templateParams?: [ string ](name='TemplateParams', description='短信模板变量对应的实际值，JSON格式。支持传入多个参数，示例：[{"name":"张三","number":"15038****76"}]。'),
}

model SendMessageResponseBody = {
  data?: {
    messages?: [ 
      {
        id?: string(name='Id', description='短信Id，可使用ListMessages查询短信状态。', example='0a54e195-03e2-40bd-869d-b71cb302783e'),
        phoneNumber?: string(name='PhoneNumber', description='手机号码。', example='1234567890'),
      }
    ](name='Messages', description='短信结果列表，列表中手机号的顺序与输入请求手机号顺序一一对应。'),
    requestId?: string(name='RequestId', description='短信批处理Id，可使用ListMessages查询短信状态。', example='62a72a20-8a9b-4060-a510-0c30a9340cba'),
  }(name='Data', description='返回数据。'),
  errorCode?: int32(name='ErrorCode', description='错误码。', example='0'),
  errorMessage?: string(name='ErrorMessage', description='错误信息。', example='OK'),
  requestId?: string(name='RequestId', description='请求ID。', example='f8651828-609d-4de8-ab49-ab781d7fd85a'),
}

model SendMessageResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: SendMessageResponseBody(name='body'),
}

async function sendMessageWithOptions(request: SendMessageRequest, headers: map[string]string, runtime: Util.RuntimeOptions): SendMessageResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.groupId)) {
    body['GroupId'] = request.groupId;
  }
  if (!Util.isUnset(request.outIds)) {
    body['OutIds'] = request.outIds;
  }
  if (!Util.isUnset(request.paymentType)) {
    body['PaymentType'] = request.paymentType;
  }
  if (!Util.isUnset(request.phoneNumbers)) {
    body['PhoneNumbers'] = request.phoneNumbers;
  }
  if (!Util.isUnset(request.scheduleId)) {
    body['ScheduleId'] = request.scheduleId;
  }
  if (!Util.isUnset(request.signName)) {
    body['SignName'] = request.signName;
  }
  if (!Util.isUnset(request.signatureId)) {
    body['SignatureId'] = request.signatureId;
  }
  if (!Util.isUnset(request.smsUpExtendCodes)) {
    body['SmsUpExtendCodes'] = request.smsUpExtendCodes;
  }
  if (!Util.isUnset(request.templateCode)) {
    body['TemplateCode'] = request.templateCode;
  }
  if (!Util.isUnset(request.templateId)) {
    body['TemplateId'] = request.templateId;
  }
  if (!Util.isUnset(request.templateParams)) {
    body['TemplateParams'] = request.templateParams;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'SendMessage',
    version = '2022-01-12',
    protocol = 'HTTPS',
    pathname = `/api/v2/messages`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function sendMessage(request: SendMessageRequest): SendMessageResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return sendMessageWithOptions(request, headers, runtime);
}

model SmsReportRequest {
  body?: [ 
    {
      bizId?: string(name='biz_id', description='发送回执ID，即发送流水号。', example='12345'),
      errCode?: string(name='err_code', description='状态报告编码。', example='DELIVERED'),
      errMsg?: string(name='err_msg', description='状态报告说明。', example='用户接收成功'),
      messageId?: string(name='message_id', description='短信Id。调用发送接口SendMessage发送短信时，返回值中的Id字段。可使用短信Id在接口ListMessages查询具体的发送状态。', example='123'),
      outId?: string(name='out_id', description='外部拓展字段。', example='123'),
      phoneNumber?: string(name='phone_number', description='手机号码。', example='1390000****'),
      reportTime?: string(name='report_time', description='状态报告时间。', example='2017-09-01 00:00:00'),
      requestId?: string(name='request_id', description='短信批处理Id。调用发送接口SendMessage发送短信时，返回值中的RequestId字段。可使用短信批处理Id在接口ListMessages查询具体的发送状态。', example='62a72a20-8a9b-4060-a510-0c30a9340cba'),
      sendTime?: string(name='send_time', description='发送时间。', example='2017-09-01 00:00:00'),
      signName?: string(name='sign_name', description='签名。', example='签名'),
      smsSize?: string(name='sms_size', description='短信长度。短信长度不超过70个字，按照一条短信计费；超过70个字，即为长短信，按照67字/条拆分成多条计费。', example='1'),
      success?: boolean(name='success', description='是否接收成功。
- true : 接收成功。
- false : 接收失败。', example='true'),
      templateCode?: string(name='template_code', description='模板号。', example='SMS_123456'),
    }
  ](name='body', description='请求参数的主体信息。'),
}

model SmsReportResponseBody = {
  code?: int32(name='code', description='应答编码。', example='0'),
  msg?: string(name='msg', description='描述信息。', example='接受成功'),
}

model SmsReportResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: SmsReportResponseBody(name='body'),
}

/**
  * 短信回执。
  *
  * @param request SmsReportRequest
  * @param headers map
  * @param runtime runtime options for this request RuntimeOptions
  * @return SmsReportResponse
 */
async function smsReportWithOptions(request: SmsReportRequest, headers: map[string]string, runtime: Util.RuntimeOptions): SmsReportResponse {
  Util.validateModel(request);
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = Util.toArray(request.body),
  };
  var params = new OpenApi.Params{
    action = 'SmsReport',
    version = '2022-01-12',
    protocol = 'HTTPS',
    pathname = `/api/v2/recall/report`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
  * 短信回执。
  *
  * @param request SmsReportRequest
  * @return SmsReportResponse
 */
async function smsReport(request: SmsReportRequest): SmsReportResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return smsReportWithOptions(request, headers, runtime);
}

model SmsUpRequest {
  body?: [ 
    {
      content?: string(name='content', description='发送内容。', example='内容'),
      destCode?: string(name='dest_code', description='上行短信扩展号码，系统后台自动生成，不支持自定义传入。', example='1234'),
      phoneNumber?: string(name='phone_number', description='手机号码。', example='1390000****'),
      sendTime?: string(name='send_time', description='发送时间。', example='2017-09-01 00:00:00'),
      sequenceId?: int32(name='sequence_id', description='序列号。', example='1234567890'),
      signName?: string(name='sign_name', description='签名信息。', example='签名'),
    }
  ](name='body', description='请求参数的主体信息。'),
}

model SmsUpResponseBody = {
  code?: int32(name='code', description='应答编码。', example='0'),
  msg?: string(name='msg', description='描述信息。', example='接受成功'),
}

model SmsUpResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: SmsUpResponseBody(name='body'),
}

/**
  * 短信上行。
  *
  * @param request SmsUpRequest
  * @param headers map
  * @param runtime runtime options for this request RuntimeOptions
  * @return SmsUpResponse
 */
async function smsUpWithOptions(request: SmsUpRequest, headers: map[string]string, runtime: Util.RuntimeOptions): SmsUpResponse {
  Util.validateModel(request);
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = Util.toArray(request.body),
  };
  var params = new OpenApi.Params{
    action = 'SmsUp',
    version = '2022-01-12',
    protocol = 'HTTPS',
    pathname = `/api/v2/recall/up`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
  * 短信上行。
  *
  * @param request SmsUpRequest
  * @return SmsUpResponse
 */
async function smsUp(request: SmsUpRequest): SmsUpResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return smsUpWithOptions(request, headers, runtime);
}

model UpdateCampaignRequest {
  name?: string(name='Name', description='运营活动名称。', example='VIP客户'),
  remark?: string(name='Remark', description='备注。', example='双十一活动'),
}

model UpdateCampaignResponseBody = {
  data?: {
    createdTime?: string(name='CreatedTime', description='创建时间 (UTC+8)。', example='2020-01-01 12:00:00'),
    id?: string(name='Id', description='运营活动Id。', example='0a54e195-03e2-40bd-869d-b71cb302783e'),
    name?: string(name='Name', description='运营活动名称。', example='VIP客户'),
    remark?: string(name='Remark', description='备注。', example='双十一活动'),
    updatedTime?: string(name='UpdatedTime', description='更新时间 (UTC+8)。', example='2020-01-01 12:00:00'),
  }(name='Data', description='返回数据。'),
  errorCode?: int32(name='ErrorCode', description='错误码。', example='0'),
  errorMessage?: string(name='ErrorMessage', description='错误信息。', example='OK'),
  requestId?: string(name='RequestId', description='请求ID。', example='f8651828-609d-4de8-ab49-ab781d7fd85a'),
}

model UpdateCampaignResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: UpdateCampaignResponseBody(name='body'),
}

/**
  * 更新运营活动
  *
  * @param request UpdateCampaignRequest
  * @param headers map
  * @param runtime runtime options for this request RuntimeOptions
  * @return UpdateCampaignResponse
 */
async function updateCampaignWithOptions(Id: string, request: UpdateCampaignRequest, headers: map[string]string, runtime: Util.RuntimeOptions): UpdateCampaignResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.name)) {
    body['Name'] = request.name;
  }
  if (!Util.isUnset(request.remark)) {
    body['Remark'] = request.remark;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'UpdateCampaign',
    version = '2022-01-12',
    protocol = 'HTTPS',
    pathname = `/api/v2/campaigns/${OpenApiUtil.getEncodeParam(Id)}`,
    method = 'PUT',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
  * 更新运营活动
  *
  * @param request UpdateCampaignRequest
  * @return UpdateCampaignResponse
 */
async function updateCampaign(Id: string, request: UpdateCampaignRequest): UpdateCampaignResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return updateCampaignWithOptions(Id, request, headers, runtime);
}

model UpdateReportUrlRequest {
  url?: string(name='Url', description='可公开访问的地址。', example='http://example.com'),
}

model UpdateReportUrlResponseBody = {
  data?: string(name='Data', description='返回数据。', example='OK'),
  errorCode?: int32(name='ErrorCode', description='错误码。', example='0'),
  errorMessage?: string(name='ErrorMessage', description='错误信息。', example='OK'),
  requestId?: string(name='RequestId', description='请求ID。', example='f8651828-609d-4de8-ab49-ab781d7fd85a'),
}

model UpdateReportUrlResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: UpdateReportUrlResponseBody(name='body'),
}

/**
  * 更新回执Url。
  *
  * @param request UpdateReportUrlRequest
  * @param headers map
  * @param runtime runtime options for this request RuntimeOptions
  * @return UpdateReportUrlResponse
 */
async function updateReportUrlWithOptions(request: UpdateReportUrlRequest, headers: map[string]string, runtime: Util.RuntimeOptions): UpdateReportUrlResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.url)) {
    body['Url'] = request.url;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'UpdateReportUrl',
    version = '2022-01-12',
    protocol = 'HTTPS',
    pathname = `/api/v2/users/reportUrl`,
    method = 'PUT',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
  * 更新回执Url。
  *
  * @param request UpdateReportUrlRequest
  * @return UpdateReportUrlResponse
 */
async function updateReportUrl(request: UpdateReportUrlRequest): UpdateReportUrlResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return updateReportUrlWithOptions(request, headers, runtime);
}

model UpdateUploadUrlRequest {
  url?: string(name='Url', description='可公开访问的地址。', example='http://example.com'),
}

model UpdateUploadUrlResponseBody = {
  data?: string(name='Data', description='返回数据。', example='OK'),
  errorCode?: int32(name='ErrorCode', description='错误码。', example='0'),
  errorMessage?: string(name='ErrorMessage', description='错误信息。', example='OK'),
  requestId?: string(name='RequestId', description='请求ID。', example='f8651828-609d-4de8-ab49-ab781d7fd85a'),
}

model UpdateUploadUrlResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: UpdateUploadUrlResponseBody(name='body'),
}

/**
  * 更新上行Url。
  *
  * @param request UpdateUploadUrlRequest
  * @param headers map
  * @param runtime runtime options for this request RuntimeOptions
  * @return UpdateUploadUrlResponse
 */
async function updateUploadUrlWithOptions(request: UpdateUploadUrlRequest, headers: map[string]string, runtime: Util.RuntimeOptions): UpdateUploadUrlResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.url)) {
    body['Url'] = request.url;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'UpdateUploadUrl',
    version = '2022-01-12',
    protocol = 'HTTPS',
    pathname = `/api/v2/users/uploadUrl`,
    method = 'PUT',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
  * 更新上行Url。
  *
  * @param request UpdateUploadUrlRequest
  * @return UpdateUploadUrlResponse
 */
async function updateUploadUrl(request: UpdateUploadUrlRequest): UpdateUploadUrlResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return updateUploadUrlWithOptions(request, headers, runtime);
}

